1df.index.name # Show me the current name
2df.index.name = 'my_column_name' # Change the index name to my_column_name
1import pandas as pd
2
3# Sample DataFrame
4df = pd.DataFrame({'a': [1, 2], 'b': [3, 4]})
5
6# Changing columns name with index number
7df.columns.values[0] = "b"
8df.columns.values[1] = "a"
9
10# Display
11display(df)
12