How can I add indexes of similar values from two csv to each of them

0 votes
So I have two csv files:
csv1.csv:

2010-12-10, Steve, Jobs, 20
2010-12-12, Elon, Musk, 23
2011-01-02, Larry, Page, 25

csv2.csv:

2015-01-03, STeve JObs, 34
2015-02-13, Elon Musk, 27
2015-01-17, LArry Page, 18
2015-09-11, Steve Jobs, 25

The task is about finding similarities in these two files by name ofc and adding a row (in new column) with their index/indices from another file.
For now I extract columns (merge 2 from csv1 and append as new column, both as DataFrames), uppercase them and I can print their positions in the opposite file (very primitive, nested loop and external int indices). Does pandas provide some tools to get what I want? Do you have any idea for possible solution? What should I learn more about? ;)

Desired output of ex. csv1:
2010-12-10, Steve, Jobs, 20, [1,4]
2010-12-12, Elon, Musk, 23,
2011-01-02, Larry, Page, 25,

csv2:

csv2.csv:

2015-01-03, STeve JObs, 34,1
2015-02-13, Elon Musk, 27,
2015-01-17, LArry Page, 18,
2015-09-11, Steve Jobs, 25,1
Aug 13, 2020 in Python by Alex
• 120 points
669 views

Hello @Alex ,

You can refer this for your query:https://docs.python.org/3/library/csv.html

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

How can I convert a list of dictionaries from a CSV into a JSON object in Python?

You could try using the AST module. ...READ MORE

answered Apr 17, 2018 in Python by anonymous
3,458 views
0 votes
2 answers

How can I write a program to add two numbers using functions in python?

there is sum() function as a built ...READ MORE

answered Oct 25, 2020 in Python by anonymous
23,842 views
0 votes
1 answer

How do I add a link from the Django admin page of one object to the admin page of a related object?

Hello @kartik, Set show_change_link to True (False by default) in your inline ...READ MORE

answered Jun 12, 2020 in Python by Niroj
• 82,840 points
10,602 views
0 votes
1 answer

How to list a column of float values from csv file without importing (Python)

Using the default CSV module Demo: import csv with open(filename, "r") ...READ MORE

answered Sep 16, 2020 in Python by Rajiv
• 8,870 points
8,937 views
0 votes
1 answer

How can I get list of values from dict?

Here is an example to get the ...READ MORE

answered Feb 14, 2022 in Python by Nandini
• 5,480 points
1,236 views
0 votes
1 answer

How can I compare the content of two files in Python?

Assuming that your file unique.txt just contains ...READ MORE

answered Apr 16, 2018 in Python by charlie_brown
• 7,720 points
2,655 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP