rename(self, index=None, *, axis=None, copy=True, inplace=False, level=None, errors='ignore') -> 'Series | None'
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 Series.name
with a scalar value.
See the user guide <basics.rename>
for more.
Unused. Accepted for compatibility with DataFrame method only.
Functions or dict-like are transformations to apply to the index. Scalar or hashable sequence-like will alter the Series.name
attribute.
Additional keyword arguments passed to the function. Only the "inplace" keyword is used.
Series with index labels or name altered or None if inplace=True
.
Alter Series index labels or name.
DataFrame.rename
Corresponding DataFrame method.
Series.rename_axis
Set the name of the axis.
>>> s = pd.Series([1, 2, 3])This example is valid syntax, but we were not able to check execution
... 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: int64This example is valid syntax, but we were not able to check execution
>>> s.rename(lambda x: x ** 2) # function, changes labels 0 1 1 2 4 3 dtype: int64This example is valid syntax, but we were not able to check execution
>>> s.rename({1: 3, 2: 5}) # mapping, changes labels 0 1 3 2 5 3 dtype: int64See :
The following pages refer to to this document either explicitly or contain code examples using this.
pandas.core.generic.NDFrame.rename_axis
pandas.core.generic.NDFrame._set_axis_name
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them