name columns by index in pandas code example
Example 1: python: change column name
df = df.rename(columns = {'myvar':'myvar_new'})
Example 2: rename dataframe index column pandas
df.index.names = ['new_name']
df = df.rename(columns = {'myvar':'myvar_new'})
df.index.names = ['new_name']