Series.
rename
Alter Series index labels or name.
Functions are transformations to apply to the index. Scalar will alter the Series.name attribute.
Whether to return a new Series. If True then value of copy is ignored.
Series with index labels or name altered.
Examples
>>> s = ps.Series([1, 2, 3]) >>> s 0 1 1 2 2 3 dtype: int64
>>> s.rename("my_name") # scalar, changes Series.name 0 1 1 2 2 3 Name: my_name, dtype: int64
>>> s.rename(lambda x: x ** 2) # function, changes labels 0 1 1 2 4 3 dtype: int64