dataframe rename index column name code example
Example 1: rename dataframe index column pandas
df.index.names = ['new_name']
Example 2: dataframe names pandas
print(df.rename(columns={'A': 'a', 'C': 'c'}))
df.index.names = ['new_name']
print(df.rename(columns={'A': 'a', 'C': 'c'}))