I have a Pandas Dataframe read in from a CSV file.
I want to create a larger Dataframe what includes some of the columns in the CSV file - however the header names are different so translation is needed.
The larger Dataframe values not included in the CSV file should be settable to some default value.
My best idea so far is to start with the dataframe from the CSV and use a dictionary to translate the column names. Then I can add the remaining columns to the resulting structure. This feels a bit clunky tho - any suggestions on how to best approach this?
An illustrative example
Initial CSV file:
Name,Age,Address,PhoneNumber
Dataframe output:
Given the above we have - Age=Age, FullName=Name, HomeAddress=Address.
The defaults for example could be - Nationality="USA", WorkAddress="Google", StarSign="Leo".
PhoneNumber is ignored completely in the output.
Age,Nationality,FullName,HomeAddress,WorkAddress,StarSign