I would appreciate your help with the following issue I have. I don't want 'attribure_dat_part' to change during this code. I only wanted to apply the rename changes to 'ego_attribute_data'. Please let me know what I am missing.
Thanks a lot guys!
ego_attribute_data = pd.DataFrame(attribute_dat_part)
#column header renaming:
ego_attribute_data.rename(columns = {'email':'ego',
'Title':'ego_title',
'Team':'ego_team',
'Manager Status':'ego_manager_status',
'Location':'ego_location'},
inplace=True)
print(attribute_dat_part)
print(ego_attribute_data)
email Title Team Manager Status Location
person.1@widgetcorp.com CFO Finance Executive Headquarters
person.2@widgetcorp.com CTO Technology Executive Headquarters
person.3@widgetcorp.com CSO Sales Executive Headquarters
person.4@widgetcorp.com CEO and President CEO CEO Headquarters
The data comes from excel and is read in as follows:
attribute_dat_part=pd.read_excel('Course Data\Sample ONA Data.xlsx',
sheet_name='Attribute Data from HRIS')
This way my original object is not getting overwritten:
ego_attribute_data=pd.DataFrame(attribute_dat_part).rename(columns = {'email':'ego', 'Title':'ego_title', 'Team':'ego_team', 'Manager Status':'ego_manager_status', 'Location':'ego_location'}, inplace=False)