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

0 votes
So I have two csv files:

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


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,



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 12, 2020 in Python by Alex
• 120 points

Hello @Alex ,

You can refer this for your query:

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
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 24, 2020 in Python by anonymous
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,820 points
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,890 points
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,780 points
0 votes
1 answer

How can I find out the index of an element from row and column in Python?

You probably want to use np.ravel_multi_index: [code] import numpy ...READ MORE

answered Apr 16, 2018 in Python by charlie_brown
• 7,780 points
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 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,366 views
0 votes
0 answers