1df.rename(columns={'oldName1': 'newName1',
2 'oldName2': 'newName2'},
3 inplace=True, errors='raise')
4# Make sure you set inplace to True if you want the change
5# to be applied to the dataframe
1import pandas as pd
2data = pd.read_csv(file)
3data.rename(columns={'original':'new_name'}, inplace=True)
1df.rename({'a': 'X', 'b': 'Y'}, axis=1, inplace=True)
2df
3
4 X Y c d e
50 x x x x x
61 x x x x x
72 x x x x x
8
9