@@ -1481,7 +1481,54 @@ def str_rsplit(arr, pat=None, n=None):
1481
1481
1482
1482
Returns
1483
1483
-------
1484
- split : Series/Index or DataFrame/MultiIndex of objects
1484
+ Series/Index or DataFrame/MultiIndex of objects
1485
+
1486
+ See Also
1487
+ --------
1488
+ str.rsplit : Standard library version of this method.
1489
+
1490
+ Examples
1491
+ --------
1492
+ >>> s = pd.Series(["this is good text", "but this is even better"])
1493
+
1494
+ By default, split will return an object of the same size
1495
+ having lists containing the split elements
1496
+
1497
+ >>> s.str.rsplit()
1498
+ 0 [this, is, good, text]
1499
+ 1 [but, this, is, even, better]
1500
+ dtype: object
1501
+ >>> s.str.rsplit("random")
1502
+ 0 [this is good text]
1503
+ 1 [but this is even better]
1504
+ dtype: object
1505
+
1506
+ When using ''expand=True'', the split elements will expand out into
1507
+ separate columns.
1508
+
1509
+ For Series object, output return type is DataFrame.
1510
+
1511
+ >>> s.str.rsplit(expand=True)
1512
+ 0 1 2 3 4
1513
+ 0 this is good text None
1514
+ 1 but this is even better
1515
+
1516
+ Parameter 'n' can be used to limit the number of splits in the output.
1517
+
1518
+ >>> s.str.rsplit("is", n=1)
1519
+ 0 [this , good text]
1520
+ 1 [but this , even better]
1521
+ dtype: object
1522
+
1523
+ If NaN is present, it is propagated throughout the columns
1524
+ during the split.
1525
+
1526
+ >>> s = pd.Series(["this is good text", "but this is even better", np.nan])
1527
+ >>> s.str.rsplit(n=3, expand=True)
1528
+ 0 1 2 3
1529
+ 0 this is good text
1530
+ 1 but this is even better
1531
+ 2 NaN NaN NaN NaN
1485
1532
"""
1486
1533
if n is None or n == 0 :
1487
1534
n = - 1
0 commit comments