Pandas Series: add_prefix() function

Prefix labels with string prefix in Pandas series

The add_prefix() function is used to prefix labels with string prefix.

For Series, the row labels are prefixed. For DataFrame, the column labels are prefixed.


Series.add_prefix(self, prefix)
Pandas Series add_prefix image


Name Description Type/Default Value Required / Optional
prefix The string to add before each label. str Required

Returns: Series or DataFrame
New Series or DataFrame with updated labels.


Download the Pandas Series Notebooks from here.

Previous: Replace values in Pandas Series
Next: Suffix labels with string suffix in Pandas series

Share this Tutorial / Exercise on : Facebook and Twitter