bigframes.pandas.Series.rename#

Series.rename(index: blocks.Label | Mapping[Any, Any] = None) Series[source]#
Series.rename(index: blocks.Label | Mapping[Any, Any] = None, *, inplace: Literal[False], **kwargs) Series
Series.rename(index: blocks.Label | Mapping[Any, Any] = None, *, inplace: Literal[True], **kwargs) None

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 Series.name with a scalar value.

Examples:

>>> s = bpd.Series([1, 2, 3])
>>> s
0    1
1    2
2    3
dtype: Int64

You can changes the Series name by specifying a string scalar:

>>> s.rename("my_name")
0    1
1    2
2    3
Name: my_name, dtype: Int64

You can change the labels by specifying a mapping:

>>> s.rename({1: 3, 2: 5})
0    1
3    2
5    3
dtype: Int64
Parameters:
  • index (scalar, hashable sequence, dict-like or function optional) – Functions or dict-like are transformations to apply to the index. Scalar or hashable sequence-like will alter the Series.name attribute.

  • inplace (bool) – Default False. Whether to return a new Series.

Returns:

Series with index labels or None if inplace=True.

Return type:

bigframes.pandas.Series | None