how to change name of a column in pandas dataframe code example
Example 1: rename dataframe index column pandas
df.index.names = ['new_name']
Example 2: rename column pandas
>>> df.rename({1: 2, 2: 4}, axis='index')
A B
0 1 4
2 2 5
4 3 6