-1

I have two .csv files with the following customer information as headers:

First name
Last name
Email
Phone number
Street name
House number
City
Zip code
Country
Date -- last time customer information was updated

I want to go through both files, and export a single file with the most recent customer information.

For example,

File 1 contains the following for a single customer:

First name - John
Last name - Smith
Email - jsmith@verizon.net
Phone number - 123 456 7890
Street name - Baker St
House number - 50
City - London
Zip code - 12345
Country - England
Date - 01-06-2016 (DD-MM-YYYY)

And file 2 contains the following information for the same customer:

First name - John
Last name - Smith
Email - jsmith@gmail.com
Phone number - 098 765 4321
Street name - Baker St
House number - 50
City - London
Zip code - 12345
Country - England
Date - 01-10-2016

I want to use the information for this customer from file 2 in the exported file.

Any suggestions how to go about doing this in Python?

Thanks!

  • Have you looked at csv module in python? https://docs.python.org/2/library/csv.html You can parse both files, compare the dates, and create new file with correct data – Christian Safka Oct 04 '16 at 12:53

1 Answers1

0

I suggest you to use pandas. You may create two DataFrame's and after that you may update first frame by the second. I found a question which looks similar like your(https://stackoverflow.com/questions/7971513/using-one-data-frame-to-update-another ) I hope that it can help you.

Community
  • 1
  • 1
korvinos
  • 509
  • 3
  • 7