cudf.Series.rename#

Series.rename(index=None, axis=None, copy: bool = True, inplace: bool = False, level=None, errors: Literal['ignore', 'raise'] = 'ignore')[source]#

Alter Series name

Change Series.name with a scalar value

Parameters:
indexScalar, optional

Scalar to alter the Series.name attribute

axis{0 or ‘index’}

Unused. Parameter needed for compatibility with DataFrame.

copyboolean, default True

Also copy underlying data

inplacebool, default False

Whether to return a new Series. If True the value of copy is ignored. Currently not supported.

levelint or level name, default None

In case of MultiIndex, only rename labels in the specified level. Currently not supported.

errors{‘ignore’, ‘raise’}, default ‘ignore’

If ‘raise’, raise KeyError when a dict-like mapper or index contains labels that are not present in the index being transformed. If ‘ignore’, existing keys will be renamed and extra keys will be ignored. Currently not supported.

Returns:
Series

Examples

>>> import cudf
>>> series = cudf.Series([10, 20, 30])
>>> series
0    10
1    20
2    30
dtype: int64
>>> series.name
>>> renamed_series = series.rename('numeric_series')
>>> renamed_series
0    10
1    20
2    30
Name: numeric_series, dtype: int64
>>> renamed_series.name
'numeric_series'

Pandas Compatibility Note

pandas.Series.rename()

  • Supports scalar values only for changing name attribute