pyspark.pandas.Series.rename¶
-
Series.
rename
(index: Union[Any, Tuple[Any, …], None] = None, **kwargs: Any) → pyspark.pandas.series.Series[source]¶ Alter Series name.
- Parameters
- indexscalar
Scalar will alter the
Series.name
attribute.- inplacebool, default False
Whether to return a new Series. If True then value of copy is ignored.
- Returns
- Series
Series with 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