pandas 0.8.1 documentation

pandas.Series.rename

Series.rename(mapper, inplace=False)

Alter Series index using dict or function

Parameters :

mapper : dict-like or function

Transformation to apply to each index

Returns :

renamed : Series (new object)

Notes

Function / dict values must be unique (1-to-1)

Examples

>>> x
foo 1
bar 2
baz 3
>>> x.rename(str.upper)
FOO 1
BAR 2
BAZ 3
>>> x.rename({'foo' : 'a', 'bar' : 'b', 'baz' : 'c'})
a 1
b 2
c 3