4

I'm trying to rename the index of a series libor I have from DATE to Date:

libor.rename(index={"DATE": "Date"})

The result is unforunately the same as it went in though:

            VALUE
DATE    
1986-01-02  8.12500
1986-01-03  8.12500
1986-01-06  8.18750

I was hoping that 'DATE' would become 'Date'. I'm trying to multiply it with a Dataframe with a 'Date' index, on a column-by-column basis.

How can I rename the index?

cjm2671
  • 16,836
  • 28
  • 92
  • 144

2 Answers2

6

Just change the name property of the index.

libor.index.name = 'Date'
Alexander
  • 96,739
  • 27
  • 183
  • 184
3

you can use rename_axis() for that:

Example:

In [310]: s
Out[310]:
Index
0    1
1    2
2    3
dtype: int64

In [312]: s = s.rename_axis('idx')

In [313]: s
Out[313]:
idx
0    1
1    2
2    3
dtype: int64
MaxU - stop genocide of UA
  • 191,778
  • 30
  • 340
  • 375