@@ -1343,24 +1343,7 @@ def str_pad(arr, width, side='left', fillchar=' '):
1343
1343
1344
1344
1345
1345
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
+
1364
1347
if pat is None :
1365
1348
if n is None or n == 0 :
1366
1349
n = - 1
@@ -1380,24 +1363,7 @@ def str_split(arr, pat=None, n=None):
1380
1363
1381
1364
1382
1365
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
+
1401
1367
if n is None or n == 0 :
1402
1368
n = - 1
1403
1369
f = lambda x : x .rsplit (pat , n )
@@ -2243,9 +2209,8 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
2243
2209
_shared_docs ['str_split' ] = ("""
2244
2210
Split strings around given separator/delimiter.
2245
2211
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`.
2249
2214
2250
2215
Parameters
2251
2216
----------
@@ -2294,7 +2259,7 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
2294
2259
1 [but, this, is, even, better]
2295
2260
dtype: object
2296
2261
2297
- >>> s.str.rsplit()
2262
+ >>> s.str.rsplit()
2298
2263
0 [this, is, good, text]
2299
2264
1 [but, this, is, even, better]
2300
2265
dtype: object
@@ -2345,7 +2310,7 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
2345
2310
0 1 2 3
2346
2311
0 this is good text
2347
2312
1 but this is even better
2348
- 2 NaN NaN NaN NaN
2313
+ 2 NaN NaN NaN NaN
2349
2314
2350
2315
>>> s.str.rsplit(n=3, expand=True)
2351
2316
0 1 2 3
@@ -2354,14 +2319,20 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
2354
2319
2 NaN NaN NaN NaN
2355
2320
""" )
2356
2321
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
+ })
2359
2327
def split (self , pat = None , n = - 1 , expand = False ):
2360
2328
result = str_split (self ._data , pat , n = n )
2361
2329
return self ._wrap_result (result , expand = expand )
2362
2330
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
+ })
2365
2336
def rsplit (self , pat = None , n = - 1 , expand = False ):
2366
2337
result = str_rsplit (self ._data , pat , n = n )
2367
2338
return self ._wrap_result (result , expand = expand )
0 commit comments