Skip to content

Commit fee3c61

Browse files
committed
DOC: update the pandas.Series.str.strip docstring
1 parent a54a326 commit fee3c61

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

pandas/core/strings.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,35 +2160,44 @@ def encode(self, encoding, errors="strict"):
21602160
Parameters
21612161
----------
21622162
to_strip : str
2163-
specifying the set of characters to be removed.
2163+
Specifying the set of characters to be removed.
21642164
All combinations of this set of characters will be stripped.
21652165
Default value is None, which means whaitspaces will be removed.
21662166
21672167
Returns
21682168
-------
21692169
stripped : Series/Index of objects
21702170
2171+
See Also
2172+
--------
2173+
str.slice : Slice substrings from each element in the Series/Index
2174+
21712175
Examples
21722176
--------
21732177
Striping whitespaces for Series
21742178
2175-
>>>s = pd.Series([' ant', 'bee ', ' cat '])
2176-
>>>s
2179+
>>> s = pd.Series([' ant', 'bee ', ' cat '])
2180+
2181+
>>> s
21772182
0 ant
21782183
1 bee
21792184
2 cat
21802185
dtype: object
2181-
>>>s.str.strip()
2186+
2187+
>>> s.str.strip()
21822188
0 ant
21832189
1 bee
21842190
2 cat
21852191
dtype: object
21862192
21872193
Striping a set of characters for Index
2188-
>>>df = pd.DataFrame(index=['1.ant ','2._bee__','3. cat_'])
2189-
>>>pd.index
2194+
2195+
>>> df = pd.DataFrame(index=['1.ant ','2._bee__','3. cat_'])
2196+
2197+
>>> df.index
21902198
Index(['1.ant ', '2._bee__', '3. cat_'], dtype='object')
2191-
>>>df.index.str.strip('123._ ')
2199+
2200+
>>> df.index.str.strip('123._ ')
21922201
Index(['ant', 'bee', 'cat'], dtype='object')
21932202
""")
21942203

0 commit comments

Comments
 (0)