If I have 2 csv files as follows:
csv1.csv:
104,Bob,Bob@gmail.com,baseball
189,Tom,Tom@gmail.com.football
932,Bill,Bill@gmail.com,softball
csv2.csv:
134,Tim,Tim@gmail.com,cricket
189,Tom,TomR@gmail.com,tennis
692,Rob,Rob@gmail.com,soccer
I am looking for a Python way to compare the 2 CSV files (only Column 1), and if column1 is the same in both CSV files, then write the entire row from CSV1.csv to a new CSV file.
So in this example, the only time column 1 is the same is '189'. So the new output.csv file would just have 1 line, and be 189,Tom,Tom@gmail.com.football
I have tried import pandas, csv, and every time I attempt this I am hitting a roadblock.