Alter Series index labels or name.

Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don’t throw an error.

Alternatively, change with a scalar value.

See the user guide for more.

param index
scalar, hashable sequence, dict-like or function, optional

dict-like or functions are transformations to apply to the index. Scalar or hashable sequence-like will alter the attribute.

param copy
bool, default True

Whether to copy underlying data.

param inplace
bool, default False

Whether to return a new Series. If True then value of copy is ignored.

param level
int or level name, default None

In case of a MultiIndex, only rename labels in the specified level.


Series Series with index labels or name altered.


  • Parameter level is currently unsupported by Intel Scalable Dataframe Compiler


Alter Series index labels or name.
import numpy as np
import pandas as pd
from numba import njit

def series_rename():
    s = pd.Series(np.arange(5))

    return s

$ python ./series/
0    0
1    1
2    2
3    3
4    4
dtype: int64