Remove index name in pandas

markov zain picture markov zain · Apr 21, 2015 · Viewed 117.7k times · Source

I have a dataframe like this one:

In [10]: df
Out[10]: 
         Column 1
foo              
Apples          1
Oranges         2
Puppies         3
Ducks           4

How to remove index name foo from that dataframe? The desired output is like this:

In [10]: df
Out[10]: 
         Column 1             
Apples          1
Oranges         2
Puppies         3
Ducks           4

Answer

EdChum picture EdChum · Apr 21, 2015

Alternatively you can just assign None to the index.name attribute:

>>> df.index.name = None
>>> print(df)
         Column 1    
Apples          1
Oranges         2
Puppies         3
Ducks           4