Skip to content

Commit 4d7d71b

Browse files
committed
Modified see also
1 parent 25bf40b commit 4d7d71b

File tree

1 file changed

+16
-45
lines changed

1 file changed

+16
-45
lines changed

pandas/core/strings.py

+16-45
Original file line numberDiff line numberDiff line change
@@ -1343,24 +1343,7 @@ def str_pad(arr, width, side='left', fillchar=' '):
13431343

13441344

13451345
def str_split(arr, pat=None, n=None):
1346-
"""
1347-
Split strings around given separator/delimiter.
1348-
1349-
Parameters
1350-
----------
1351-
pat : str, optional
1352-
String or regular expression to split on; If not specified,
1353-
split on whitespace.
1354-
n : int, default -1 (all)
1355-
Limit number of splits in output; ``None``, 0 and -1 will
1356-
be interpreted as return all splits.
1357-
expand : bool, default False
1358-
Expand the splitted strings into separate columns.
1359-
1360-
Returns
1361-
-------
1362-
Series, Index, DataFrame or MultiIndex
1363-
"""
1346+
13641347
if pat is None:
13651348
if n is None or n == 0:
13661349
n = -1
@@ -1380,24 +1363,7 @@ def str_split(arr, pat=None, n=None):
13801363

13811364

13821365
def str_rsplit(arr, pat=None, n=None):
1383-
"""
1384-
Split strings around given separator/delimiter (starting from
1385-
the right).
1386-
1387-
Parameters
1388-
----------
1389-
pat : string, default None
1390-
Separator to split on; If None, splits on whitespace.
1391-
n : int, default -1 (all)
1392-
None, 0 and -1 will be interpreted as return all splits.
1393-
expand : bool, default False
1394-
If True, return DataFrame/MultiIndex expanding dimensionality.
1395-
If False, return Series/Index.
1396-
1397-
Returns
1398-
-------
1399-
Series/Index or DataFrame/MultiIndex of objects
1400-
"""
1366+
14011367
if n is None or n == 0:
14021368
n = -1
14031369
f = lambda x: x.rsplit(pat, n)
@@ -2243,9 +2209,8 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
22432209
_shared_docs['str_split'] = ("""
22442210
Split strings around given separator/delimiter.
22452211
2246-
Returns a list of the words from each string in Series/Index,
2247-
split by the given delimiter string, starting at the %(side)s of the
2248-
string. Equivalent to :meth:`str.%(method)s`.
2212+
Splits the string in the Series/Index from the %(side)s,
2213+
at the specified delimiter string.Equivalent to :meth:`str.%(method)s`.
22492214
22502215
Parameters
22512216
----------
@@ -2294,7 +2259,7 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
22942259
1 [but, this, is, even, better]
22952260
dtype: object
22962261
2297-
>>> s.str.rsplit()
2262+
>>> s.str.rsplit()
22982263
0 [this, is, good, text]
22992264
1 [but, this, is, even, better]
23002265
dtype: object
@@ -2345,7 +2310,7 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
23452310
0 1 2 3
23462311
0 this is good text
23472312
1 but this is even better
2348-
2 NaN NaN NaN NaN
2313+
2 NaN NaN NaN NaN
23492314
23502315
>>> s.str.rsplit(n=3, expand=True)
23512316
0 1 2 3
@@ -2354,14 +2319,20 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
23542319
2 NaN NaN NaN NaN
23552320
""")
23562321

2357-
@Appender(_shared_docs['str_split'] % dict(side='start',
2358-
method='split'))
2322+
@Appender(_shared_docs['str_split'] % {
2323+
'side': 'beginning',
2324+
'method': 'split',
2325+
'also': 'rsplit : Splits string at the last occurrence of delimiter'
2326+
})
23592327
def split(self, pat=None, n=-1, expand=False):
23602328
result = str_split(self._data, pat, n=n)
23612329
return self._wrap_result(result, expand=expand)
23622330

2363-
@Appender(_shared_docs['str_split'] % dict(side='end',
2364-
method='rsplit'))
2331+
@Appender(_shared_docs['str_split'] % {
2332+
'side': 'end',
2333+
'method': 'rsplit',
2334+
'also': 'split : Splits string at the first occurrence of delimiter'
2335+
})
23652336
def rsplit(self, pat=None, n=-1, expand=False):
23662337
result = str_rsplit(self._data, pat, n=n)
23672338
return self._wrap_result(result, expand=expand)

0 commit comments

Comments
 (0)