Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2978,15 +2978,37 @@ def add_prefix(self, prefix):

def add_suffix(self, suffix):
"""
Concatenate suffix string with panel items names.
Add a suffix string to Series items names.

Parameters
----------
suffix : string
suffix : str
The string to add after each item name.

Returns
-------
with_suffix : type of caller
Series
Original Series with updated item names.

See Also
--------
Series.add_prefix: Concatenate prefix string with Series items names.

Examples
--------
>>> s = pd.Series([1, 2, 3, 4])
>>> s
0 1
1 2
2 3
3 4
dtype: int64
>>> s.add_suffix('_item')
0_item 1
1_item 2
2_item 3
3_item 4
dtype: int64
"""
new_data = self._data.add_suffix(suffix)
return self._constructor(new_data).__finalize__(self)
Expand Down