DEV Community

Nilotpal Choudhury
Nilotpal Choudhury

Posted on

Answer: Rename Pandas DataFrame Index

The rename method takes a dictionary for the index which applies to index values.
You want to rename to index level's name:

df.index.names = ['Date']

A good way to think about this is that columns and index are the same type of object (Index or MultiIndex), and

Top comments (0)