How do I reference the default index column in a pandas dataframe?
df.set_index(['index', 'second_column'])
- NOT using
reset_index()
or if i wanted to rename the default index column
df.rename(columns={'index': 'new_column_name'})
1
To reference the default index you can use:
df.index
To rename the index you can use:
df.index.name = 'new_name'
1