pyspark.pandas.Series.add_prefix¶
-
Series.
add_prefix
(prefix: str) → pyspark.pandas.series.Series[source]¶ Prefix labels with string prefix.
For Series, the row labels are prefixed. For DataFrame, the column labels are prefixed.
- Parameters
- prefixstr
The string to add before each label.
- Returns
- Series
New Series with updated labels.
See also
Series.add_suffix
Suffix column labels with string suffix.
DataFrame.add_suffix
Suffix column labels with string suffix.
DataFrame.add_prefix
Prefix column labels with string prefix.
Examples
>>> s = ps.Series([1, 2, 3, 4]) >>> s 0 1 1 2 2 3 3 4 dtype: int64
>>> s.add_prefix('item_') item_0 1 item_1 2 item_2 3 item_3 4 dtype: int64