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
  • 18,348
  • 31
  • 102
  • 161

2 Answers2

6

Just change the name property of the index.

libor.index.name = 'Date'
Alexander
  • 105,104
  • 32
  • 201
  • 196
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 - stand with Ukraine
  • 205,989
  • 36
  • 386
  • 419