How do I map column names of two different csv files to say they are the same? (Python)

Viewed 16

I am working on a data masking project. I have built a program that reads a csv file and changes the first name, drivers license and other information that identifies the person. Now, I want the program to work with other csv files too, For example, a csv file has "first_name" column instead of "first". How do I create a .ini file to say that they are both the same? an how do I make the program work with any csv files?

Something like this.

[General]

Locale = 'en_US', 'es_MX', 'en_IN'
Header = Yes
WriteHeaderInOutput = Yes
PreserveIds = No
PreserveAge = Yes
PreserveEmailDomain = Yes
PreserveVINMakeModel = Yes
PreserveNulls = Yes
UniquenessPreservation = Id, SSN, Email, Phone, DL_State, DL_Nbr, PolicyNum, ClaimNum, VIN

[Mappings]

Id = id
First = first_name
Last = last_name
Street = street_address
City = off
State = state
Zip = off
DOB = date_of_birth
SSN = ssn
Gender = off
Email = email
Phone = phone
Drivers icense = drivers_license_number
Policy Number = policy_number
Claim number = claim_number
VIN = VIN
User ID = User_Name
License Plate = License_Plate
0 Answers
Related