Skip to content

DOC: update the pandas.Series.add_suffix docstring #20315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 13, 2018
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