Sep-29-2019, 08:25 AM
I'm new to Python from VisualBasic, so excuse my basic question.
I am trying to match two CSV files, based on the data in columns P1-P5:
CSV#1:
Header Row1 = DataCol1, DataCol2, DataCol3, P1, P2, P3, P4, P5
Row2 = data1, data2, data3, 1,2,3,4,5
etc...
CSV#2:
Header Row1 = ColName1, ColName2, ColName3, P1, P2, P3, P4, P5
Row2 = ea1, ea2, ea3, 3,5,6,2,1
Row3 = db1, db2, db3, 1,2,3,4,5
etc...
I would like:
1) To match each row in CSV1 against it's corresponding data in columns P1-P5 in CSV2
2) Combined these matched rows to form a new row in a new file, CSV#3:
eg:-
CSV#3:
Header Row1 = DataCol1, DataCol2, DataCol3, P1, P2, P3, P4, P5, ColName1, ColName2, ColName3, P1, P2, P3, P4, P5
Row1 = data1, data2, data3, 1,2,3,4,5, db1, db2, db3, 1,2,3,4,5
etc...
I am lost how to do this!
Is there a way to do this as quick as possible, bearing in mind the CSV files are large (sometimes up to 99999 rows).
I found a module called "pandas" but it is beyond my current understanding.
Thank you very much :)
I am trying to match two CSV files, based on the data in columns P1-P5:
CSV#1:
Header Row1 = DataCol1, DataCol2, DataCol3, P1, P2, P3, P4, P5
Row2 = data1, data2, data3, 1,2,3,4,5
etc...
CSV#2:
Header Row1 = ColName1, ColName2, ColName3, P1, P2, P3, P4, P5
Row2 = ea1, ea2, ea3, 3,5,6,2,1
Row3 = db1, db2, db3, 1,2,3,4,5
etc...
I would like:
1) To match each row in CSV1 against it's corresponding data in columns P1-P5 in CSV2
2) Combined these matched rows to form a new row in a new file, CSV#3:
eg:-
CSV#3:
Header Row1 = DataCol1, DataCol2, DataCol3, P1, P2, P3, P4, P5, ColName1, ColName2, ColName3, P1, P2, P3, P4, P5
Row1 = data1, data2, data3, 1,2,3,4,5, db1, db2, db3, 1,2,3,4,5
etc...
I am lost how to do this!
Is there a way to do this as quick as possible, bearing in mind the CSV files are large (sometimes up to 99999 rows).
I found a module called "pandas" but it is beyond my current understanding.
Thank you very much :)