1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
U
¬ý°d¿®ã@s¸UddlmZddlZddlmZddlZddlmZmZm    Z    m
Z
m Z ddl Z ddl ZddlmZddlmZmZmZmZddlmZddlmZdd    lmZmZmZmZmZm Z m!Z!dd
l"m#Z#m$Z$m%Z%m&Z&dd l'm(Z(dd l)m*Z*dd l+m,Z,ddl-m.Z.erddl/m0Z0m1Z1m2Z2iZ3de4d<dZ5e5dZ6d3ddddœdd„Z7dd„Z8Gdd„de,ƒZ9ddd œd!d"„Z:ddd œd#d$„Z;d%d&„Z<d'd(d)œd*d+„Z=d'd,d)œd-d.„Z>d4d/d0œd1d2„Z?dS)5é)Ú annotationsN)Úwraps)Ú TYPE_CHECKINGÚCallableÚHashableÚLiteralÚcast)Úlib)Ú    AlignJoinÚDtypeObjÚFÚScalar)ÚAppender)Úfind_stack_level)Ú ensure_objectÚ is_bool_dtypeÚis_categorical_dtypeÚ
is_integerÚ is_list_likeÚis_object_dtypeÚis_re)Ú ABCDataFrameÚABCIndexÚ ABCMultiIndexÚ    ABCSeries©Úisna)Ú
ArrowDtype)ÚNoNewAttributesMixin)Ú extract_array)Ú    DataFrameÚIndexÚSerieszdict[str, str]Ú _shared_docs)zutf-8Úutf8zlatin-1Úlatin1z
iso-8859-1ÚmbcsÚascii)zutf-16zutf-32zlist[str] | Nonez
str | NonezCallable[[F], F])Ú    forbiddenÚnameÚreturncs@|dkr gn|}dddddht|ƒ‰dddœ‡‡fd    d
„ }|S) aý
    Decorator to forbid specific types for a method of StringMethods.
 
    For calling `.str.{method}` on a Series or Index, it is necessary to first
    initialize the :class:`StringMethods` object, and then call the method.
    However, different methods allow different input types, and so this can not
    be checked during :meth:`StringMethods.__init__`, but must be done on a
    per-method basis. This decorator exists to facilitate this process, and
    make it explicit which (inferred) types are disallowed by the method.
 
    :meth:`StringMethods.__init__` allows the *union* of types its different
    methods allow (after skipping NaNs; see :meth:`StringMethods._validate`),
    namely: ['string', 'empty', 'bytes', 'mixed', 'mixed-integer'].
 
    The default string types ['string', 'empty'] are allowed for all methods.
    For the additional types ['bytes', 'mixed', 'mixed-integer'], each method
    then needs to forbid the types it is not intended for.
 
    Parameters
    ----------
    forbidden : list-of-str or None
        List of forbidden non-string types, may be one or more of
        `['bytes', 'mixed', 'mixed-integer']`.
    name : str, default None
        Name of the method to use in the error message. By default, this is
        None, in which case the name from the method being wrapped will be
        copied. However, for working with further wrappers (like _pat_wrapper
        and _noarg_wrapper), it is necessary to specify the name.
 
    Returns
    -------
    func : wrapper
        The method to which the decorator is applied, with an added check that
        enforces the inferred type to not be in the list of forbidden types.
 
    Raises
    ------
    TypeError
        If the inferred type of the underlying data is in `forbidden`.
    NÚstringÚemptyÚbytesÚmixedú mixed-integerr )Úfuncr*cs:ˆdkrˆjnˆ‰tˆƒ‡‡‡fdd„ƒ}ˆ|_tt|ƒS)Ncs6|jˆkr&dˆ›d|j›d}t|ƒ‚ˆ|f|ž|ŽS)NzCannot use .str.z  with values of inferred dtype 'z'.)Ú_inferred_dtypeÚ    TypeError)ÚselfÚargsÚkwargsÚmsg)Ú allowed_typesr0Ú    func_name©úSd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/core/strings/accessor.pyÚwrapperys
 
ÿzHforbid_nonstring_types.<locals>._forbid_nonstring_types.<locals>.wrapper)Ú__name__rrr )r0r;©r7r))r0r8r:Ú_forbid_nonstring_typesvs
    z7forbid_nonstring_types.<locals>._forbid_nonstring_types)Úset)r(r)r>r9r=r:Úforbid_nonstring_typesDs ,ÿr@cs$tdgˆd‡fdd„ƒ}||_|S)Nr-©r)cs t|jjdˆ›ƒƒ}| |¡S)NZ_str_)ÚgetattrÚ_dataÚarrayÚ _wrap_result©r3ÚresultrAr9r:r;Šsz_map_and_wrap.<locals>.wrapper)r@Ú__doc__)r)Ú    docstringr;r9rAr:Ú _map_and_wrap‰s rJc @sâeZdZUdZddœdd„Zedd„ƒZdd    „Zd
d
ej    d d fd dddœdd„Z
dd„Z e dddgƒdûdddœdd„ƒZ ded<eeddd d!d"d#d$d%d&d'œƒe dgƒdüd(d d
d)œd*dd d+œd,d-„ƒƒZeedd.d/d0d/d/d/d1d/d'œƒe dgƒdýd(d d2œdd3œd4d5„ƒƒZd6ed7<eed7d8d9d:d;œƒe dgƒdþd=dd>œd?d@„ƒƒZeed7dAdBdCd;œƒe dgƒdÿd=dd>œdDdE„ƒƒZdFdG„Ze dgƒdHdI„ƒZe dgƒdddKddLœdMdN„ƒZe dgƒdddKdOœdPdQ„ƒZe dgƒdddKdOœdRdS„ƒZe dgƒddTdUdKd dKddVœdWdX„ƒZe dgƒdYdZ„ƒZe dgƒdd[d=d\œd]d^„ƒZd_ed`<eed`dadbdcœƒe dgƒdd=ddœdedf„ƒƒZeed`dgdhdcœƒe dgƒdd=ddœdidj„ƒƒZeed`ddkdcœƒe dgƒdd=ddœdldm„ƒƒZe dgƒdndo„ƒZddpdq„Z e dgƒd    drds„ƒZ!d
d=duœdvdw„Z"e dgƒd d=duœdxdy„ƒZ#dzed{<eed{d|d}d~dœƒe dgƒd d€d„ƒƒZ$eed{d‚dƒd„dœƒe dgƒd d…d†„ƒƒZ%eed{d‡dˆd‰dœƒe dgƒddŠd‹„ƒƒZ&dŒed<eeddŽddœƒe dgƒd‘d’„ƒƒZ'eedddŽdœƒe dgƒd“d”„ƒƒZ(e dgƒd•d–„ƒZ)e dgƒdd=d˜œd™dš„ƒZ*e dgƒd›dœ„ƒZ+e dgƒddKdœdždŸ„ƒZ,e dgƒdd d¡d¢d£œd¤d¥„ƒZ-e dgƒdd d¡d¢d£œd¦d§„ƒZ.e dgƒddKdœd¨d©„ƒZ/e dgƒdd=dKddªd«œd¬d­„ƒZ0e dgƒddKdœd®d¯„ƒZ1d°ed±<eed±d²d±d³d´œƒe dgƒddKdµœd¶d·„ƒƒZ2eed±d¸d¹dºd´œƒe dgƒddKdµœd»d¼„ƒƒZ3e dgƒd½d¾„ƒZ4d¿edÀ<eedÀd²d±dÀdÁdœƒe dgƒddKdµœdÃdĄƒƒZ5eedÀd¸d¹dÅdÆdœƒe dgƒddKdµœdÇdȄƒƒZ6dÉdʄZ7dËedÌ<iZ8dÍe9dÎ<dÏdÐd/dќe8dÐ<dÒdÓd/dќe8dÓ<dÔdÕd/dќe8dÕ<dÖd×d/dќe8d×<dØdÙd/dќe8dÙ<dÚdÛd/dќe8dÛ<eedÌe8dЃe dgƒdÜd݄ƒƒZ:eedÌe8dÓƒe dgƒdÞd߄ƒƒZ;eedÌe8dÕƒe dgƒdàdᄃƒZ<eedÌe8d׃e dgƒdâd㄃ƒZ=eedÌe8dÙƒe dgƒdäd儃ƒZ>eedÌe8dÛƒe dgƒdæd焃ƒZ?dèedé<dêdëdìœe8dë<dídîdìœe8dî<dïdðdìœe8dð<dñdòdìœe8dò<dÏdódìœe8dó<dÒdôdìœe8dô<dÔdõdìœe8dõ<död÷dìœe8d÷<dødùdìœe8dù<e@dëedée8dëdúZAe@dîedée8dîdúZBe@dðedée8dðdúZCe@dòedée8dòdúZDe@dóedée8dódúZEe@dôedée8dôdúZFe@dõedée8dõdúZGe@d÷edée8d÷dúZHe@dùedée8dùdúZId
S(Ú StringMethodsaß
    Vectorized string functions for Series and Index.
 
    NAs stay NA unless handled otherwise by a particular method.
    Patterned after Python's string methods, with some inspiration from
    R's stringr package.
 
    Examples
    --------
    >>> s = pd.Series(["A_Str_Series"])
    >>> s
    0    A_Str_Series
    dtype: object
 
    >>> s.str.split("_")
    0    [A, Str, Series]
    dtype: object
 
    >>> s.str.replace("_", "")
    0    AStrSeries
    dtype: object
    ÚNone)r*cCs„ddlm}| |¡|_t|jƒ|_t|j|ƒ|_||_    d|_
|_ t|t ƒr^|j |_
|j|_ |jrl|jjn||_||_| ¡dS©Nr)Ú StringDtype)Úpandas.core.arrays.string_rNÚ    _validater1rÚdtypeZ_is_categoricalÚ
isinstanceÚ
_is_stringrCÚ_indexÚ_namerÚindexr)Z_valuesÚ
categoriesÚ_parentÚ_origZ_freeze)r3ÚdatarNr9r9r:Ú__init__²s    
zStringMethods.__init__cCsVt|tƒrtdƒ‚dddddg}t|ƒ}t|d|ƒ}tj|dd    }||krRtd
ƒ‚|S) a
        Auxiliary function for StringMethods, infers and checks dtype of data.
 
        This is a "first line of defence" at the creation of the StringMethods-
        object, and just checks that the dtype is in the
        *union* of the allowed types over all string methods below; this
        restriction is then refined on a per-method basis using the decorator
        @forbid_nonstring_types (more info in the corresponding docstring).
 
        This really should exclude all series/index with any non-string values,
        but that isn't practical for performance reasons until we have a str
        dtype (GH 9343 / 13877)
 
        Parameters
        ----------
        data : The content of the Series
 
        Returns
        -------
        dtype : inferred dtype of data
        z5Can only use .str accessor with Index, not MultiIndexr+r,r-r.r/rWT©Zskipnaz.Can only use .str accessor with string values!)rRrÚAttributeErrorrrBr    Ú infer_dtype)rZr7ÚvaluesZinferred_dtyper9r9r:rPÅs
ÿ zStringMethods._validatecCs|jj |¡}| |¡S©N)rCrDZ _str_getitemrE)r3ÚkeyrGr9r9r:Ú __getitem__îszStringMethods.__getitem__NTFz bool | NoneÚbool)ÚexpandÚreturns_stringÚ returns_boolcsÄddlm}m}t|dƒr$t|dƒsBt|tƒr>|j|jdd}|S|jdksPt    ‚|dkrf|jdk}n|d    krjt|jt
ƒsjt|j t ƒrddl ‰dd
lm‰ˆj |j ¡ ¡¡ ¡‰| ¡ ¡rÚ|j dgˆ¡|_|dk    rè|}    ntˆƒ}    ‡‡fd d „t|    t| ¡ŽƒDƒ}nVt|ƒrjd d„‰‡fdd„|Dƒ}|rj|jsjtdd„|Dƒƒ‰‡fdd„|Dƒ}t|tƒs~tdƒ‚|dkr°|dkržt |ddƒ}|dkr°|jj!}t|jt
ƒrt"|ƒrÌ|S|rt#|ƒ}|j$||d}
|
j%dkrþ|
 &d¡}
|
S|||dSn°|jj'} t |ddƒ} |jrTt"| ƒr>|j } n|rN|jj } n| } n| } |rx|jj(}|||| | d}n|jj)}|||| | d}|j|jdd}|dk    r¼|jdkr¼||_!|SdS)Nr)r!Ú
MultiIndexÚndimrQÚstrrAééT)ÚArrowExtensionArraycs i|]\}}|ˆˆ |¡ƒ“qSr9)rD)Ú.0ÚlabelÚres)rlÚpar9r:Ú
<dictcomp> sÿz.StringMethods._wrap_result.<locals>.<dictcomp>cSst|ƒr |S|gSdSr`©r©Úxr9r9r:Úcons_row&sz,StringMethods._wrap_result.<locals>.cons_rowcsg|] }ˆ|ƒ‘qSr9r9©rmrt)rur9r:Ú
<listcomp>,sz.StringMethods._wrap_result.<locals>.<listcomp>css|]}t|ƒVqdSr`)Úlenrvr9r9r:Ú    <genexpr>/sz-StringMethods._wrap_result.<locals>.<genexpr>cs2g|]*}t|ƒdks"|dtjkr*|ˆn|‘qS)r)rxÚnpÚnanrv)Úmax_lenr9r:rw0sÿúexpand must be True or FalseFr)©Únames©ÚcolumnsrVrQ)r)rVrQ©Úmethod)*Úpandasr!rgÚhasattrrRrÚ __finalize__rYrhÚAssertionErrorrrQrZpyarrowZpandas.core.arrays.arrow.arrayrlZcomputeÚmaxrCZcombine_chunksZ value_lengthsZas_pyrÚanyZ    fill_nullÚrangeÚzipÚtolistrrSrcÚ
ValueErrorrBr)rÚlistÚ from_tuplesÚnlevelsZget_level_valuesrVÚ_constructor_expanddimZ _constructor)r3rGr)rdÚ
fill_valuererfr!rgÚlabelsÚoutrVZvdtyperQZconsr9)rlrur|rpr:rEòs„    
  ÿ  þ
 
þ 
 
 
 
 
 
 
zStringMethods._wrap_resultcsddlm}m}t|jtƒr"|jn|jj}tˆtƒr:ˆgStˆtƒrV|ˆ|ˆjdgStˆt    ƒrr‡fdd„ˆDƒStˆt
j ƒr¦ˆj dkr¦|ˆ|d‰‡fdd„ˆDƒSt ˆd    d
rtˆƒ‰td d „ˆDƒƒrðg}ˆrì|| ˆ d¡¡}qÒ|Std d „ˆDƒƒr|ˆ|dgStdƒ‚dS)añ
        Auxiliary function for :meth:`str.cat`. Turn potentially mixed input
        into a list of Series (elements without an index must match the length
        of the calling Series/Index).
 
        Parameters
        ----------
        others : Series, DataFrame, np.ndarray, list-like or list-like of
            Objects that are either Series, Index or np.ndarray (1-dim).
 
        Returns
        -------
        list of Series
            Others transformed into list of Series.
        r)r r"©rVrQcsg|] }ˆ|‘qSr9r9rv©Úothersr9r:rw‘sz2StringMethods._get_series_list.<locals>.<listcomp>é)rVcsg|] }ˆ|‘qSr9r9rvr–r9r:rw”sF)Z
allow_setscss2|]*}t|ttfƒp(t|tjƒo(|jdkVqdS)rkN)rRrrrzÚndarrayrhrvr9r9r:ryšsþz1StringMethods._get_series_list.<locals>.<genexpr>css|]}t|ƒ VqdSr`rrrvr9r9r:ry¤sz£others must be Series, Index, DataFrame, np.ndarray or list-like (either containing only strings or containing only objects of type Series/Index/np.ndarray[1-dim])N)r„r r"rRrYrrVrrQrrzr™rhrrŽÚallÚ_get_series_listÚpopr2)r3r—r r"ÚidxZlosr9r–r:r›qs2
 
 
 ýÿzStringMethods._get_series_listr-r.r/Úleftr
zstr | Series | Index)Újoinr*c
s¤ddlm}m}m}tˆtƒr&tdƒ‚|dkr2d}t|jtƒrV||j|j|jj    d‰n|j‰ˆdkrÂt
ˆƒ‰t ˆƒ}ˆdkr”|  ¡r”|  ˆ|¡Sˆdk    r¸|  ¡r¸|  t |ˆˆ¡¡S|  ˆ¡Sz| ˆ¡‰Wn.tk
rþ}    ztdƒ|    ‚W5d}    ~    XYnXt ‡fdd    „ˆDƒƒrf|ˆd
|d kr,|nd ttˆƒƒd d d‰ˆjˆ|d\‰‰‡fdd„ˆDƒ‰dd„ˆgˆDƒ}
t dd„|
Dƒ¡} tjj| dd} ˆdkrø|   ¡røtjtˆƒtd} t | | tj¡| ‰t‡fdd„|
Dƒ|ƒ| ˆ<nBˆdk    r0|   ¡r0‡fdd„t| |
ƒDƒ}
t|
|ƒ} n
t|
|ƒ} t|jtƒr\|| t|jjd}nDt|jj    ƒrpd}n|jj    }|| |ˆj|jjd d}|j |jdd}|S)ae
        Concatenate strings in the Series/Index with given separator.
 
        If `others` is specified, this function concatenates the Series/Index
        and elements of `others` element-wise.
        If `others` is not passed, then all values in the Series/Index are
        concatenated into a single string with a given `sep`.
 
        Parameters
        ----------
        others : Series, Index, DataFrame, np.ndarray or list-like
            Series, Index, DataFrame, np.ndarray (one- or two-dimensional) and
            other list-likes of strings must have the same length as the
            calling Series/Index, with the exception of indexed objects (i.e.
            Series/Index/DataFrame) if `join` is not None.
 
            If others is a list-like that contains a combination of Series,
            Index or np.ndarray (1-dim), then all elements will be unpacked and
            must satisfy the above criteria individually.
 
            If others is None, the method returns the concatenation of all
            strings in the calling Series/Index.
        sep : str, default ''
            The separator between the different elements/columns. By default
            the empty string `''` is used.
        na_rep : str or None, default None
            Representation that is inserted for all missing values:
 
            - If `na_rep` is None, and `others` is None, missing values in the
              Series/Index are omitted from the result.
            - If `na_rep` is None, and `others` is not None, a row containing a
              missing value in any of the columns (before concatenation) will
              have a missing value in the result.
        join : {'left', 'right', 'outer', 'inner'}, default 'left'
            Determines the join-style between the calling Series/Index and any
            Series/Index/DataFrame in `others` (objects without an index need
            to match the length of the calling Series/Index). To disable
            alignment, use `.values` on any Series/Index/DataFrame in `others`.
 
        Returns
        -------
        str, Series or Index
            If `others` is None, `str` is returned, otherwise a `Series/Index`
            (same type as caller) of objects is returned.
 
        See Also
        --------
        split : Split each string in the Series/Index.
        join : Join lists contained as elements in the Series/Index.
 
        Examples
        --------
        When not passing `others`, all values are concatenated into a single
        string:
 
        >>> s = pd.Series(['a', 'b', np.nan, 'd'])
        >>> s.str.cat(sep=' ')
        'a b d'
 
        By default, NA values in the Series are ignored. Using `na_rep`, they
        can be given a representation:
 
        >>> s.str.cat(sep=' ', na_rep='?')
        'a b ? d'
 
        If `others` is specified, corresponding values are concatenated with
        the separator. Result will be a Series of strings.
 
        >>> s.str.cat(['A', 'B', 'C', 'D'], sep=',')
        0    a,A
        1    b,B
        2    NaN
        3    d,D
        dtype: object
 
        Missing values will remain missing in the result, but can again be
        represented using `na_rep`
 
        >>> s.str.cat(['A', 'B', 'C', 'D'], sep=',', na_rep='-')
        0    a,A
        1    b,B
        2    -,C
        3    d,D
        dtype: object
 
        If `sep` is not specified, the values are concatenated without
        separation.
 
        >>> s.str.cat(['A', 'B', 'C', 'D'], na_rep='-')
        0    aA
        1    bB
        2    -C
        3    dD
        dtype: object
 
        Series with different indexes can be aligned before concatenation. The
        `join`-keyword works as in other methods.
 
        >>> t = pd.Series(['d', 'a', 'e', 'c'], index=[3, 0, 4, 2])
        >>> s.str.cat(t, join='left', na_rep='-')
        0    aa
        1    b-
        2    -c
        3    dd
        dtype: object
        >>>
        >>> s.str.cat(t, join='outer', na_rep='-')
        0    aa
        1    b-
        2    -c
        3    dd
        4    -e
        dtype: object
        >>>
        >>> s.str.cat(t, join='inner', na_rep='-')
        0    aa
        2    -c
        3    dd
        dtype: object
        >>>
        >>> s.str.cat(t, join='right', na_rep='-')
        3    dd
        0    aa
        4    -e
        2    -c
        dtype: object
 
        For more examples, see :ref:`here <text.concatenate>`.
        r)r!r"Úconcatz'Did you mean to supply a `sep` keyword?NÚr•zŽIf `others` contains arrays or lists (or other list-likes without an index), these must all be of the same length as the calling Series/Index.c3s|]}ˆj |j¡ VqdSr`)rVÚequalsrv)rZr9r:ry_sz$StringMethods.cat.<locals>.<genexpr>rkÚinnerÚouterF)ÚaxisrŸÚkeysÚsortÚcopy)rŸcsg|] }ˆ|‘qSr9r9rvr–r9r:rwjsz%StringMethods.cat.<locals>.<listcomp>cSsg|] }t|ƒ‘qSr9)rrvr9r9r:rwlscSsg|] }t|ƒ‘qSr9rrvr9r9r:rwms©r¥©rQcsg|] }|ˆ‘qSr9r9rv)Ú
not_maskedr9r:rwwscsg|]\}}t |ˆ|¡‘qSr9)rzÚwhere)rmÚnmÚcol)Úna_repr9r:rwzs)rQr))rQrVr)r¨Zstr_catr‚)!r„r!r"r rRrirrYrrQrrr‰rŸrzr¬r›rŠrxZalignrDÚ
logical_orÚreducer,ÚobjectZputmaskr{Úcat_safer‹r)rrVr†)r3r—Úsepr¯rŸr!r"r Zna_maskÚerrZall_colsZna_masksZ
union_maskrGr”rQZres_serr9)rZr¯r«r—r:Úcat­s€ 
 
ÿü
ú
ÿ 
ÿzStringMethods.cataÉ
    Split strings around given separator/delimiter.
 
    Splits the string in the Series/Index from the %(side)s,
    at the specified delimiter string.
 
    Parameters
    ----------
    pat : str%(pat_regex)s, optional
        %(pat_description)s.
        If not specified, split on whitespace.
    n : int, default -1 (all)
        Limit number of splits in output.
        ``None``, 0 and -1 will be interpreted as return all splits.
    expand : bool, default False
        Expand the split strings into separate columns.
 
        - If ``True``, return DataFrame/MultiIndex expanding dimensionality.
        - If ``False``, return Series/Index, containing lists of strings.
    %(regex_argument)s
    Returns
    -------
    Series, Index, DataFrame or MultiIndex
        Type matches caller unless ``expand=True`` (see Notes).
    %(raises_split)s
    See Also
    --------
    Series.str.split : Split strings around given separator/delimiter.
    Series.str.rsplit : Splits string around given separator/delimiter,
        starting from the right.
    Series.str.join : Join lists contained as elements in the Series/Index
        with passed delimiter.
    str.split : Standard library version for split.
    str.rsplit : Standard library version for rsplit.
 
    Notes
    -----
    The handling of the `n` keyword depends on the number of found splits:
 
    - If found splits > `n`,  make first `n` splits only
    - If found splits <= `n`, make all splits
    - If for a certain row the number of found splits < `n`,
      append `None` for padding up to `n` if ``expand=True``
 
    If using ``expand=True``, Series and Index callers return DataFrame and
    MultiIndex objects, respectively.
    %(regex_pat_note)s
    Examples
    --------
    >>> s = pd.Series(
    ...     [
    ...         "this is a regular sentence",
    ...         "https://docs.python.org/3/tutorial/index.html",
    ...         np.nan
    ...     ]
    ... )
    >>> s
    0                       this is a regular sentence
    1    https://docs.python.org/3/tutorial/index.html
    2                                              NaN
    dtype: object
 
    In the default setting, the string is split by whitespace.
 
    >>> s.str.split()
    0                   [this, is, a, regular, sentence]
    1    [https://docs.python.org/3/tutorial/index.html]
    2                                                NaN
    dtype: object
 
    Without the `n` parameter, the outputs of `rsplit` and `split`
    are identical.
 
    >>> s.str.rsplit()
    0                   [this, is, a, regular, sentence]
    1    [https://docs.python.org/3/tutorial/index.html]
    2                                                NaN
    dtype: object
 
    The `n` parameter can be used to limit the number of splits on the
    delimiter. The outputs of `split` and `rsplit` are different.
 
    >>> s.str.split(n=2)
    0                     [this, is, a regular sentence]
    1    [https://docs.python.org/3/tutorial/index.html]
    2                                                NaN
    dtype: object
 
    >>> s.str.rsplit(n=2)
    0                     [this is a, regular, sentence]
    1    [https://docs.python.org/3/tutorial/index.html]
    2                                                NaN
    dtype: object
 
    The `pat` parameter can be used to split by other characters.
 
    >>> s.str.split(pat="/")
    0                         [this is a regular sentence]
    1    [https:, , docs.python.org, 3, tutorial, index...
    2                                                  NaN
    dtype: object
 
    When using ``expand=True``, the split elements will expand out into
    separate columns. If NaN is present, it is propagated throughout
    the columns during the split.
 
    >>> s.str.split(expand=True)
                                                   0     1     2        3         4
    0                                           this    is     a  regular  sentence
    1  https://docs.python.org/3/tutorial/index.html  None  None     None      None
    2                                            NaN   NaN   NaN      NaN       NaN
 
    For slightly more complex use cases like splitting the html document name
    from a url, a combination of parameter settings can be used.
 
    >>> s.str.rsplit("/", n=1, expand=True)
                                        0           1
    0          this is a regular sentence        None
    1  https://docs.python.org/3/tutorial  index.html
    2                                 NaN         NaN
    %(regex_examples)sZ    str_splitZ    beginningz or compiled regexz(String or regular expression to split ona
    regex : bool, default None
        Determines if the passed-in pattern is a regular expression:
 
        - If ``True``, assumes the passed-in pattern is a regular expression
        - If ``False``, treats the pattern as a literal string.
        - If ``None`` and `pat` length is 1, treats `pat` as a literal string.
        - If ``None`` and `pat` length is not 1, treats `pat` as a regular expression.
        - Cannot be set to False if `pat` is a compiled regex
 
        .. versionadded:: 1.4.0
         zÀ
                      Raises
                      ------
                      ValueError
                          * if `regex` is False and `pat` is a compiled regex
                      z]
    Use of `regex =False` with a `pat` as a compiled regex will raise an error.
            ÚsplitaI
    Remember to escape special characters when explicitly using regular expressions.
 
    >>> s = pd.Series(["foo and bar plus baz"])
    >>> s.str.split(r"and|plus", expand=True)
        0   1   2
    0 foo bar baz
 
    Regular expressions can be used to handle urls or file names.
    When `pat` is a string and ``regex=None`` (the default), the given `pat` is compiled
    as a regex only if ``len(pat) != 1``.
 
    >>> s = pd.Series(['foojpgbar.jpg'])
    >>> s.str.split(r".", expand=True)
               0    1
    0  foojpgbar  jpg
 
    >>> s.str.split(r"\.jpg", expand=True)
               0 1
    0  foojpgbar
 
    When ``regex=True``, `pat` is interpreted as a regex
 
    >>> s.str.split(r"\.jpg", regex=True, expand=True)
               0 1
    0  foojpgbar
 
    A compiled regex can be passed as `pat`
 
    >>> import re
    >>> s.str.split(re.compile(r"\.jpg"), expand=True)
               0 1
    0  foojpgbar
 
    When ``regex=False``, `pat` is interpreted as the string itself
 
    >>> s.str.split(r"\.jpg", regex=False, expand=True)
                   0
    0  foojpgbar.jpg
    )ÚsideZ    pat_regexZpat_descriptionZregex_argumentZ raises_splitZregex_pat_noterƒZregex_exampleséÿÿÿÿ)ÚnrdÚregexzstr | re.Pattern | None)Úpatrdr»cCsH|dkrt|ƒrtdƒ‚t|ƒr$d}|jj ||||¡}|j|||dS)NFúCCannot use a compiled regex as replacement pattern with regex=FalseT)rerd)rrrCrDZ
_str_splitrE)r3r¼rºrdr»rGr9r9r:r·sOÿzStringMethods.splitÚendr¡zString to split onÚrsplit)rºrd)rdcCs"|jjj||d}|j|||dS)N)rº©rdre)rCrDZ _str_rsplitrE)r3r¼rºrdrGr9r9r:r¿gszStringMethods.rsplita;
    Split the string at the %(side)s occurrence of `sep`.
 
    This method splits the string at the %(side)s occurrence of `sep`,
    and returns 3 elements containing the part before the separator,
    the separator itself, and the part after the separator.
    If the separator is not found, return %(return)s.
 
    Parameters
    ----------
    sep : str, default whitespace
        String to split on.
    expand : bool, default True
        If True, return DataFrame/MultiIndex expanding dimensionality.
        If False, return Series/Index.
 
    Returns
    -------
    DataFrame/MultiIndex or Series/Index of objects
 
    See Also
    --------
    %(also)s
    Series.str.split : Split strings around given separators.
    str.partition : Standard library version.
 
    Examples
    --------
 
    >>> s = pd.Series(['Linda van der Berg', 'George Pitt-Rivers'])
    >>> s
    0    Linda van der Berg
    1    George Pitt-Rivers
    dtype: object
 
    >>> s.str.partition()
            0  1             2
    0   Linda     van der Berg
    1  George      Pitt-Rivers
 
    To partition by the last space instead of the first one:
 
    >>> s.str.rpartition()
                   0  1            2
    0  Linda van der            Berg
    1         George     Pitt-Rivers
 
    To partition by something different than a space:
 
    >>> s.str.partition('-')
                        0  1       2
    0  Linda van der Berg
    1         George Pitt  -  Rivers
 
    To return a Series containing tuples instead of a DataFrame:
 
    >>> s.str.partition('-', expand=False)
    0    (Linda van der Berg, , )
    1    (George Pitt, -, Rivers)
    dtype: object
 
    Also available on indices:
 
    >>> idx = pd.Index(['X 123', 'Y 999'])
    >>> idx
    Index(['X 123', 'Y 999'], dtype='object')
 
    Which will create a MultiIndex:
 
    >>> idx.str.partition()
    MultiIndex([('X', ' ', '123'),
                ('Y', ' ', '999')],
               )
 
    Or an index with tuples with ``expand=False``:
 
    >>> idx.str.partition(expand=False)
    Index([('X', ' ', '123'), ('Y', ' ', '999')], dtype='object')
    Z str_partitionÚfirstzF3 elements containing the string itself, followed by two empty stringsz>rpartition : Split the string at the last occurrence of `sep`.)r¸r*Úalsoú ri)r´rdcCs |jj ||¡}|j|||dS©NrÀ)rCrDZ_str_partitionrE©r3r´rdrGr9r9r:Ú    partitionËs zStringMethods.partitionÚlastzF3 elements containing two empty strings, followed by the string itselfz>partition : Split the string at the first occurrence of `sep`.cCs |jj ||¡}|j|||dSrÄ)rCrDZ_str_rpartitionrErÅr9r9r:Ú
rpartitionÙs zStringMethods.rpartitioncCs|jj |¡}| |¡S)aì
        Extract element from each component at specified position or with specified key.
 
        Extract element from lists, tuples, dict, or strings in each element in the
        Series/Index.
 
        Parameters
        ----------
        i : int or hashable dict label
            Position or key of element to extract.
 
        Returns
        -------
        Series or Index
 
        Examples
        --------
        >>> s = pd.Series(["String",
        ...               (1, 2, 3),
        ...               ["a", "b", "c"],
        ...               123,
        ...               -456,
        ...               {1: "Hello", "2": "World"}])
        >>> s
        0                        String
        1                     (1, 2, 3)
        2                     [a, b, c]
        3                           123
        4                          -456
        5    {1: 'Hello', '2': 'World'}
        dtype: object
 
        >>> s.str.get(1)
        0        t
        1        2
        2        b
        3      NaN
        4      NaN
        5    Hello
        dtype: object
 
        >>> s.str.get(-1)
        0      g
        1      3
        2      c
        3    NaN
        4    NaN
        5    None
        dtype: object
 
        Return element with given key
 
        >>> s = pd.Series([{"name": "Hello", "value": "World"},
        ...               {"name": "Goodbye", "value": "Planet"}])
        >>> s.str.get('name')
        0      Hello
        1    Goodbye
        dtype: object
        )rCrDZ_str_getrE)r3ÚirGr9r9r:Úgetçs<zStringMethods.getcCs|jj |¡}| |¡S)a
        Join lists contained as elements in the Series/Index with passed delimiter.
 
        If the elements of a Series are lists themselves, join the content of these
        lists using the delimiter passed to the function.
        This function is an equivalent to :meth:`str.join`.
 
        Parameters
        ----------
        sep : str
            Delimiter to use between list entries.
 
        Returns
        -------
        Series/Index: object
            The list entries concatenated by intervening occurrences of the
            delimiter.
 
        Raises
        ------
        AttributeError
            If the supplied Series contains neither strings nor lists.
 
        See Also
        --------
        str.join : Standard library version of this method.
        Series.str.split : Split strings around given separator/delimiter.
 
        Notes
        -----
        If any of the list items is not a string object, the result of the join
        will be `NaN`.
 
        Examples
        --------
        Example with a list that contains non-string elements.
 
        >>> s = pd.Series([['lion', 'elephant', 'zebra'],
        ...                [1.1, 2.2, 3.3],
        ...                ['cat', np.nan, 'dog'],
        ...                ['cow', 4.5, 'goat'],
        ...                ['duck', ['swan', 'fish'], 'guppy']])
        >>> s
        0        [lion, elephant, zebra]
        1                [1.1, 2.2, 3.3]
        2                [cat, nan, dog]
        3               [cow, 4.5, goat]
        4    [duck, [swan, fish], guppy]
        dtype: object
 
        Join all lists using a '-'. The lists containing object(s) of types other
        than str will produce a NaN.
 
        >>> s.str.join('-')
        0    lion-elephant-zebra
        1                    NaN
        2                    NaN
        3                    NaN
        4                    NaN
        dtype: object
        )rCrDZ    _str_joinrE)r3r´rGr9r9r:rŸ&s?zStringMethods.joinrÚint)ÚcaseÚflagsr»cCsH|r"t |¡jr"tjdttƒd|jj     |||||¡}|j
||ddS)aO
        Test if pattern or regex is contained within a string of a Series or Index.
 
        Return boolean Series or Index based on whether a given pattern or regex is
        contained within a string of a Series or Index.
 
        Parameters
        ----------
        pat : str
            Character sequence or regular expression.
        case : bool, default True
            If True, case sensitive.
        flags : int, default 0 (no flags)
            Flags to pass through to the re module, e.g. re.IGNORECASE.
        na : scalar, optional
            Fill value for missing values. The default depends on dtype of the
            array. For object-dtype, ``numpy.nan`` is used. For ``StringDtype``,
            ``pandas.NA`` is used.
        regex : bool, default True
            If True, assumes the pat is a regular expression.
 
            If False, treats the pat as a literal string.
 
        Returns
        -------
        Series or Index of boolean values
            A Series or Index of boolean values indicating whether the
            given pattern is contained within the string of each element
            of the Series or Index.
 
        See Also
        --------
        match : Analogous, but stricter, relying on re.match instead of re.search.
        Series.str.startswith : Test if the start of each string element matches a
            pattern.
        Series.str.endswith : Same as startswith, but tests the end of string.
 
        Examples
        --------
        Returning a Series of booleans using only a literal pattern.
 
        >>> s1 = pd.Series(['Mouse', 'dog', 'house and parrot', '23', np.NaN])
        >>> s1.str.contains('og', regex=False)
        0    False
        1     True
        2    False
        3    False
        4      NaN
        dtype: object
 
        Returning an Index of booleans using only a literal pattern.
 
        >>> ind = pd.Index(['Mouse', 'dog', 'house and parrot', '23.0', np.NaN])
        >>> ind.str.contains('23', regex=False)
        Index([False, False, False, True, nan], dtype='object')
 
        Specifying case sensitivity using `case`.
 
        >>> s1.str.contains('oG', case=True, regex=True)
        0    False
        1    False
        2    False
        3    False
        4      NaN
        dtype: object
 
        Specifying `na` to be `False` instead of `NaN` replaces NaN values
        with `False`. If Series or Index does not contain NaN values
        the resultant dtype will be `bool`, otherwise, an `object` dtype.
 
        >>> s1.str.contains('og', na=False, regex=True)
        0    False
        1     True
        2    False
        3    False
        4    False
        dtype: bool
 
        Returning 'house' or 'dog' when either expression occurs in a string.
 
        >>> s1.str.contains('house|dog', regex=True)
        0    False
        1     True
        2     True
        3    False
        4      NaN
        dtype: object
 
        Ignoring case sensitivity using `flags` with regex.
 
        >>> import re
        >>> s1.str.contains('PARROT', flags=re.IGNORECASE, regex=True)
        0    False
        1    False
        2     True
        3    False
        4      NaN
        dtype: object
 
        Returning any digit using regular expression.
 
        >>> s1.str.contains('\\d', regex=True)
        0    False
        1    False
        2    False
        3     True
        4      NaN
        dtype: object
 
        Ensure `pat` is a not a literal pattern when `regex` is set to True.
        Note in the following example one might expect only `s2[1]` and `s2[3]` to
        return `True`. However, '.0' as a regex matches any character
        followed by a 0.
 
        >>> s2 = pd.Series(['40', '40.0', '41', '41.0', '35'])
        >>> s2.str.contains('.0', regex=True)
        0     True
        1     True
        2    False
        3     True
        4    False
        dtype: bool
        zwThis pattern is interpreted as a regular expression, and has match groups. To actually get the groups, use str.extract.)Ú
stacklevelF©r’re) ÚreÚcompileÚgroupsÚwarningsÚwarnÚ UserWarningrrCrDZ _str_containsrE)r3r¼rÌrÍÚnar»rGr9r9r:ÚcontainshsüzStringMethods.contains)rÌrÍcCs&|jjj||||d}|j||ddS)aœ
        Determine if each string starts with a match of a regular expression.
 
        Parameters
        ----------
        pat : str
            Character sequence or regular expression.
        case : bool, default True
            If True, case sensitive.
        flags : int, default 0 (no flags)
            Regex module flags, e.g. re.IGNORECASE.
        na : scalar, optional
            Fill value for missing values. The default depends on dtype of the
            array. For object-dtype, ``numpy.nan`` is used. For ``StringDtype``,
            ``pandas.NA`` is used.
 
        Returns
        -------
        Series/Index/array of boolean values
 
        See Also
        --------
        fullmatch : Stricter matching that requires the entire string to match.
        contains : Analogous, but less strict, relying on re.search instead of
            re.match.
        extract : Extract matched groups.
        ©rÌrÍrÖFrÏ)rCrDZ
_str_matchrE©r3r¼rÌrÍrÖrGr9r9r:ÚmatchòszStringMethods.matchcCs&|jjj||||d}|j||ddS)a‚
        Determine if each string entirely matches a regular expression.
 
        .. versionadded:: 1.1.0
 
        Parameters
        ----------
        pat : str
            Character sequence or regular expression.
        case : bool, default True
            If True, case sensitive.
        flags : int, default 0 (no flags)
            Regex module flags, e.g. re.IGNORECASE.
        na : scalar, optional
            Fill value for missing values. The default depends on dtype of the
            array. For object-dtype, ``numpy.nan`` is used. For ``StringDtype``,
            ``pandas.NA`` is used.
 
        Returns
        -------
        Series/Index/array of boolean values
 
        See Also
        --------
        match : Similar, but also returns `True` when only a *prefix* of the string
            matches the regular expression.
        extract : Extract matched groups.
        rØFrÏ)rCrDZ_str_fullmatchrErÙr9r9r:Ú    fullmatchszStringMethods.fullmatchzstr | re.Patternzstr | Callable)r¼ÚreplrºrÌrÍr»c    Csšt|tƒst|ƒstdƒ‚t|ƒ}|s.|dkrL|rj|dk    sB|dkrjtdƒ‚n|rZtdƒ‚nt|ƒrjtdƒ‚|dkrvd}|jjj||||||d}|     |¡S)    a[
        Replace each occurrence of pattern/regex in the Series/Index.
 
        Equivalent to :meth:`str.replace` or :func:`re.sub`, depending on
        the regex value.
 
        Parameters
        ----------
        pat : str or compiled regex
            String can be a character sequence or regular expression.
        repl : str or callable
            Replacement string or a callable. The callable is passed the regex
            match object and must return a replacement string to be used.
            See :func:`re.sub`.
        n : int, default -1 (all)
            Number of replacements to make from start.
        case : bool, default None
            Determines if replace is case sensitive:
 
            - If True, case sensitive (the default if `pat` is a string)
            - Set to False for case insensitive
            - Cannot be set if `pat` is a compiled regex.
 
        flags : int, default 0 (no flags)
            Regex module flags, e.g. re.IGNORECASE. Cannot be set if `pat` is a compiled
            regex.
        regex : bool, default False
            Determines if the passed-in pattern is a regular expression:
 
            - If True, assumes the passed-in pattern is a regular expression.
            - If False, treats the pattern as a literal string
            - Cannot be set to False if `pat` is a compiled regex or `repl` is
              a callable.
 
        Returns
        -------
        Series or Index of object
            A copy of the object with all matching occurrences of `pat` replaced by
            `repl`.
 
        Raises
        ------
        ValueError
            * if `regex` is False and `repl` is a callable or `pat` is a compiled
              regex
            * if `pat` is a compiled regex and `case` or `flags` is set
 
        Notes
        -----
        When `pat` is a compiled regex, all flags should be included in the
        compiled regex. Use of `case`, `flags`, or `regex=False` with a compiled
        regex will raise an error.
 
        Examples
        --------
        When `pat` is a string and `regex` is True (the default), the given `pat`
        is compiled as a regex. When `repl` is a string, it replaces matching
        regex patterns as with :meth:`re.sub`. NaN value(s) in the Series are
        left as is:
 
        >>> pd.Series(['foo', 'fuz', np.nan]).str.replace('f.', 'ba', regex=True)
        0    bao
        1    baz
        2    NaN
        dtype: object
 
        When `pat` is a string and `regex` is False, every `pat` is replaced with
        `repl` as with :meth:`str.replace`:
 
        >>> pd.Series(['f.o', 'fuz', np.nan]).str.replace('f.', 'ba', regex=False)
        0    bao
        1    fuz
        2    NaN
        dtype: object
 
        When `repl` is a callable, it is called on every `pat` using
        :func:`re.sub`. The callable should expect one positional argument
        (a regex object) and return a string.
 
        To get the idea:
 
        >>> pd.Series(['foo', 'fuz', np.nan]).str.replace('f', repr, regex=True)
        0    <re.Match object; span=(0, 1), match='f'>oo
        1    <re.Match object; span=(0, 1), match='f'>uz
        2                                            NaN
        dtype: object
 
        Reverse every lowercase alphabetic word:
 
        >>> repl = lambda m: m.group(0)[::-1]
        >>> ser = pd.Series(['foo 123', 'bar baz', np.nan])
        >>> ser.str.replace(r'[a-z]+', repl, regex=True)
        0    oof 123
        1    rab zab
        2        NaN
        dtype: object
 
        Using regex groups (extract second group and swap case):
 
        >>> pat = r"(?P<one>\w+) (?P<two>\w+) (?P<three>\w+)"
        >>> repl = lambda m: m.group('two').swapcase()
        >>> ser = pd.Series(['One Two Three', 'Foo Bar Baz'])
        >>> ser.str.replace(pat, repl, regex=True)
        0    tWO
        1    bAR
        dtype: object
 
        Using a compiled regex with flags
 
        >>> import re
        >>> regex_pat = re.compile(r'FUZ', flags=re.IGNORECASE)
        >>> pd.Series(['foo', 'fuz', np.nan]).str.replace(regex_pat, 'bar', regex=True)
        0    foo
        1    bar
        2    NaN
        dtype: object
        z!repl must be a string or callableNrz9case and flags cannot be set when pat is a compiled regexr½z2Cannot use a callable replacement when regex=FalseT)rºrÌrÍr»)
rRriÚcallabler2rrrCrDZ _str_replacerE)    r3r¼rÜrºrÌrÍr»Zis_compiled_rerGr9r9r:Úreplace3s4 ÿÿÿzStringMethods.replacecCs|jj |¡}| |¡S)am
        Duplicate each string in the Series or Index.
 
        Parameters
        ----------
        repeats : int or sequence of int
            Same value for all (int) or different value per (sequence).
 
        Returns
        -------
        Series or pandas.Index
            Series or Index of repeated string objects specified by
            input parameter repeats.
 
        Examples
        --------
        >>> s = pd.Series(['a', 'b', 'c'])
        >>> s
        0    a
        1    b
        2    c
        dtype: object
 
        Single int repeats string in Series
 
        >>> s.str.repeat(repeats=2)
        0    aa
        1    bb
        2    cc
        dtype: object
 
        Sequence of int repeats corresponding string in Series
 
        >>> s.str.repeat(repeats=[1, 2, 3])
        0      a
        1     bb
        2    ccc
        dtype: object
        )rCrDZ _str_repeatrE)r3ZrepeatsrGr9r9r:ÚrepeatÌs)zStringMethods.repeatz"Literal[('left', 'right', 'both')]©r¸ÚfillcharcCstt|tƒs"dt|ƒj›}t|ƒ‚t|ƒdkr6tdƒ‚t|ƒsVdt|ƒj›}t|ƒ‚|jjj    |||d}| 
|¡S)aì
        Pad strings in the Series/Index up to width.
 
        Parameters
        ----------
        width : int
            Minimum width of resulting string; additional characters will be filled
            with character defined in `fillchar`.
        side : {'left', 'right', 'both'}, default 'left'
            Side from which to fill resulting string.
        fillchar : str, default ' '
            Additional character for filling, default is whitespace.
 
        Returns
        -------
        Series or Index of object
            Returns Series or Index with minimum number of char in object.
 
        See Also
        --------
        Series.str.rjust : Fills the left side of strings with an arbitrary
            character. Equivalent to ``Series.str.pad(side='left')``.
        Series.str.ljust : Fills the right side of strings with an arbitrary
            character. Equivalent to ``Series.str.pad(side='right')``.
        Series.str.center : Fills both sides of strings with an arbitrary
            character. Equivalent to ``Series.str.pad(side='both')``.
        Series.str.zfill : Pad strings in the Series/Index by prepending '0'
            character. Equivalent to ``Series.str.pad(side='left', fillchar='0')``.
 
        Examples
        --------
        >>> s = pd.Series(["caribou", "tiger"])
        >>> s
        0    caribou
        1      tiger
        dtype: object
 
        >>> s.str.pad(width=10)
        0       caribou
        1         tiger
        dtype: object
 
        >>> s.str.pad(width=10, side='right', fillchar='-')
        0    caribou---
        1    tiger-----
        dtype: object
 
        >>> s.str.pad(width=10, side='both', fillchar='-')
        0    -caribou--
        1    --tiger---
        dtype: object
        z"fillchar must be a character, not rkz%fillchar must be a character, not strú#width must be of integer type, not rà) rRriÚtyper<r2rxrrCrDZ_str_padrE)r3Úwidthr¸rár6rGr9r9r:Úpadøs;
 zStringMethods.padaŠ
    Pad %(side)s side of strings in the Series/Index.
 
    Equivalent to :meth:`str.%(method)s`.
 
    Parameters
    ----------
    width : int
        Minimum width of resulting string; additional characters will be filled
        with ``fillchar``.
    fillchar : str
        Additional character for filling, default is whitespace.
 
    Returns
    -------
    Series/Index of objects.
    Zstr_padzleft and rightÚcenter)r¸rƒ)rácCs|j|d|dS)NZbothrà©rå©r3rärár9r9r:ræUszStringMethods.centerÚrightÚljustcCs|j|d|dS)Nréràrçrèr9r9r:rêZszStringMethods.ljustÚrjustcCs|j|d|dS)Nržràrçrèr9r9r:rë_szStringMethods.rjustcsDtˆƒs dtˆƒj›}t|ƒ‚‡fdd„}|jj |¡}| |¡S)a2
        Pad strings in the Series/Index by prepending '0' characters.
 
        Strings in the Series/Index are padded with '0' characters on the
        left of the string to reach a total string length  `width`. Strings
        in the Series/Index with length greater or equal to `width` are
        unchanged.
 
        Parameters
        ----------
        width : int
            Minimum length of resulting string; strings with length less
            than `width` be prepended with '0' characters.
 
        Returns
        -------
        Series/Index of objects.
 
        See Also
        --------
        Series.str.rjust : Fills the left side of strings with an arbitrary
            character.
        Series.str.ljust : Fills the right side of strings with an arbitrary
            character.
        Series.str.pad : Fills the specified sides of strings with an arbitrary
            character.
        Series.str.center : Fills both sides of strings with an arbitrary
            character.
 
        Notes
        -----
        Differs from :meth:`str.zfill` which has special handling
        for '+'/'-' in the string.
 
        Examples
        --------
        >>> s = pd.Series(['-1', '1', '1000', 10, np.nan])
        >>> s
        0      -1
        1       1
        2    1000
        3      10
        4     NaN
        dtype: object
 
        Note that ``10`` and ``NaN`` are not strings, therefore they are
        converted to ``NaN``. The minus sign in ``'-1'`` is treated as a
        special character and the zero is added to the right of it
        (:meth:`str.zfill` would have moved it to the left). ``1000``
        remains unchanged as it is longer than `width`.
 
        >>> s.str.zfill(3)
        0     -01
        1     001
        2    1000
        3     NaN
        4     NaN
        dtype: object
        râcs
| ˆ¡Sr`)Úzfillrs©rär9r:Ú<lambda>¤óz%StringMethods.zfill.<locals>.<lambda>)rrãr<r2rCrDÚ_str_maprE)r3rär6ÚfrGr9rír:rìds = zStringMethods.zfillcCs|jj |||¡}| |¡S)au
        Slice substrings from each element in the Series or Index.
 
        Parameters
        ----------
        start : int, optional
            Start position for slice operation.
        stop : int, optional
            Stop position for slice operation.
        step : int, optional
            Step size for slice operation.
 
        Returns
        -------
        Series or Index of object
            Series or Index from sliced substring from original string object.
 
        See Also
        --------
        Series.str.slice_replace : Replace a slice with a string.
        Series.str.get : Return element at position.
            Equivalent to `Series.str.slice(start=i, stop=i+1)` with `i`
            being the position.
 
        Examples
        --------
        >>> s = pd.Series(["koala", "dog", "chameleon"])
        >>> s
        0        koala
        1          dog
        2    chameleon
        dtype: object
 
        >>> s.str.slice(start=1)
        0        oala
        1          og
        2    hameleon
        dtype: object
 
        >>> s.str.slice(start=-1)
        0           a
        1           g
        2           n
        dtype: object
 
        >>> s.str.slice(stop=2)
        0    ko
        1    do
        2    ch
        dtype: object
 
        >>> s.str.slice(step=2)
        0      kaa
        1       dg
        2    caeen
        dtype: object
 
        >>> s.str.slice(start=0, stop=5, step=3)
        0    kl
        1     d
        2    cm
        dtype: object
 
        Equivalent behaviour to:
 
        >>> s.str[0:5:3]
        0    kl
        1     d
        2    cm
        dtype: object
        )rCrDZ
_str_slicerE)r3ÚstartÚstopÚsteprGr9r9r:Úslice¨sHzStringMethods.slicecCs|jj |||¡}| |¡S)añ
        Replace a positional slice of a string with another value.
 
        Parameters
        ----------
        start : int, optional
            Left index position to use for the slice. If not specified (None),
            the slice is unbounded on the left, i.e. slice from the start
            of the string.
        stop : int, optional
            Right index position to use for the slice. If not specified (None),
            the slice is unbounded on the right, i.e. slice until the
            end of the string.
        repl : str, optional
            String for replacement. If not specified (None), the sliced region
            is replaced with an empty string.
 
        Returns
        -------
        Series or Index
            Same type as the original object.
 
        See Also
        --------
        Series.str.slice : Just slicing without replacement.
 
        Examples
        --------
        >>> s = pd.Series(['a', 'ab', 'abc', 'abdc', 'abcde'])
        >>> s
        0        a
        1       ab
        2      abc
        3     abdc
        4    abcde
        dtype: object
 
        Specify just `start`, meaning replace `start` until the end of the
        string with `repl`.
 
        >>> s.str.slice_replace(1, repl='X')
        0    aX
        1    aX
        2    aX
        3    aX
        4    aX
        dtype: object
 
        Specify just `stop`, meaning the start of the string to `stop` is replaced
        with `repl`, and the rest of the string is included.
 
        >>> s.str.slice_replace(stop=2, repl='X')
        0       X
        1       X
        2      Xc
        3     Xdc
        4    Xcde
        dtype: object
 
        Specify `start` and `stop`, meaning the slice from `start` to `stop` is
        replaced with `repl`. Everything before or after `start` and `stop` is
        included as is.
 
        >>> s.str.slice_replace(start=1, stop=3, repl='X')
        0      aX
        1      aX
        2      aX
        3     aXc
        4    aXde
        dtype: object
        )rCrDZ_str_slice_replacerE)r3ròrórÜrGr9r9r:Ú slice_replaceósIzStringMethods.slice_replaceÚstrict)ÚerrorscsLˆtkr‡‡fdd„}nt ˆ¡‰‡‡fdd„}|jj}| |¡}| |¡S)aO
        Decode character string in the Series/Index using indicated encoding.
 
        Equivalent to :meth:`str.decode` in python2 and :meth:`bytes.decode` in
        python3.
 
        Parameters
        ----------
        encoding : str
        errors : str, optional
 
        Returns
        -------
        Series or Index
        cs | ˆˆ¡Sr`)Údecoders)Úencodingrør9r:rîRrïz&StringMethods.decode.<locals>.<lambda>csˆ|ˆƒdS)Nrr9rs)Údecoderrør9r:rîUrï)Ú_cpython_optimized_decodersÚcodecsÚ
getdecoderrCrDrðrE)r3rúrørñÚarrrGr9)rûrúrør:rù?s
 
zStringMethods.decodecCs|jj ||¡}|j|ddS)a 
        Encode character string in the Series/Index using indicated encoding.
 
        Equivalent to :meth:`str.encode`.
 
        Parameters
        ----------
        encoding : str
        errors : str, optional
 
        Returns
        -------
        Series/Index of objects
        F©re)rCrDZ _str_encoderE)r3rúrørGr9r9r:Úencode[szStringMethods.encodeaR
    Remove %(position)s characters.
 
    Strip whitespaces (including newlines) or a set of specified characters
    from each string in the Series/Index from %(side)s.
    Replaces any non-strings in Series with NaNs.
    Equivalent to :meth:`str.%(method)s`.
 
    Parameters
    ----------
    to_strip : str or None, default None
        Specifying the set of characters to be removed.
        All combinations of this set of characters will be stripped.
        If None then whitespaces are removed.
 
    Returns
    -------
    Series or Index of object
 
    See Also
    --------
    Series.str.strip : Remove leading and trailing characters in Series/Index.
    Series.str.lstrip : Remove leading characters in Series/Index.
    Series.str.rstrip : Remove trailing characters in Series/Index.
 
    Examples
    --------
    >>> s = pd.Series(['1. Ant.  ', '2. Bee!\n', '3. Cat?\t', np.nan, 10, True])
    >>> s
    0    1. Ant.
    1    2. Bee!\n
    2    3. Cat?\t
    3          NaN
    4           10
    5         True
    dtype: object
 
    >>> s.str.strip()
    0    1. Ant.
    1    2. Bee!
    2    3. Cat?
    3        NaN
    4        NaN
    5        NaN
    dtype: object
 
    >>> s.str.lstrip('123.')
    0    Ant.
    1    Bee!\n
    2    Cat?\t
    3       NaN
    4       NaN
    5       NaN
    dtype: object
 
    >>> s.str.rstrip('.!? \n\t')
    0    1. Ant
    1    2. Bee
    2    3. Cat
    3       NaN
    4       NaN
    5       NaN
    dtype: object
 
    >>> s.str.strip('123.!? \n\t')
    0    Ant
    1    Bee
    2    Cat
    3    NaN
    4    NaN
    5    NaN
    dtype: object
    Z    str_stripzleft and right sidesÚstripzleading and trailing)r¸rƒÚpositioncCs|jj |¡}| |¡Sr`)rCrDZ
_str_striprE©r3Zto_striprGr9r9r:rºs
zStringMethods.stripz    left sideÚlstripÚleadingcCs|jj |¡}| |¡Sr`)rCrDZ _str_lstriprErr9r9r:rÇszStringMethods.lstripz
right sideÚrstripZtrailingcCs|jj |¡}| |¡Sr`)rCrDZ _str_rstriprErr9r9r:rÐszStringMethods.rstripa­
    Remove a %(side)s from an object series.
 
    If the %(side)s is not present, the original string will be returned.
 
    Parameters
    ----------
    %(side)s : str
        Remove the %(side)s of the string.
 
    Returns
    -------
    Series/Index: object
        The Series or Index with given %(side)s removed.
 
    See Also
    --------
    Series.str.remove%(other_side)s : Remove a %(other_side)s from an object series.
 
    Examples
    --------
    >>> s = pd.Series(["str_foo", "str_bar", "no_prefix"])
    >>> s
    0    str_foo
    1    str_bar
    2    no_prefix
    dtype: object
    >>> s.str.removeprefix("str_")
    0    foo
    1    bar
    2    no_prefix
    dtype: object
 
    >>> s = pd.Series(["foo_str", "bar_str", "no_suffix"])
    >>> s
    0    foo_str
    1    bar_str
    2    no_suffix
    dtype: object
    >>> s.str.removesuffix("_str")
    0    foo
    1    bar
    2    no_suffix
    dtype: object
    Z str_removefixÚprefixÚsuffix)r¸Z
other_sidecCs|jj |¡}| |¡Sr`)rCrDZ_str_removeprefixrE)r3rrGr9r9r:Ú removeprefix    szStringMethods.removeprefixcCs|jj |¡}| |¡Sr`)rCrDZ_str_removesuffixrE)r3r    rGr9r9r:Ú removesuffixszStringMethods.removesuffixcKs|jjj|f|Ž}| |¡S)a­
        Wrap strings in Series/Index at specified line width.
 
        This method has the same keyword parameters and defaults as
        :class:`textwrap.TextWrapper`.
 
        Parameters
        ----------
        width : int
            Maximum line width.
        expand_tabs : bool, optional
            If True, tab characters will be expanded to spaces (default: True).
        replace_whitespace : bool, optional
            If True, each whitespace character (as defined by string.whitespace)
            remaining after tab expansion will be replaced by a single space
            (default: True).
        drop_whitespace : bool, optional
            If True, whitespace that, after wrapping, happens to end up at the
            beginning or end of a line is dropped (default: True).
        break_long_words : bool, optional
            If True, then words longer than width will be broken in order to ensure
            that no lines are longer than width. If it is false, long words will
            not be broken, and some lines may be longer than width (default: True).
        break_on_hyphens : bool, optional
            If True, wrapping will occur preferably on whitespace and right after
            hyphens in compound words, as it is customary in English. If false,
            only whitespaces will be considered as potentially good places for line
            breaks, but you need to set break_long_words to false if you want truly
            insecable words (default: True).
 
        Returns
        -------
        Series or Index
 
        Notes
        -----
        Internally, this method uses a :class:`textwrap.TextWrapper` instance with
        default settings. To achieve behavior matching R's stringr library str_wrap
        function, use the arguments:
 
        - expand_tabs = False
        - replace_whitespace = True
        - drop_whitespace = True
        - break_long_words = False
        - break_on_hyphens = False
 
        Examples
        --------
        >>> s = pd.Series(['line to be wrapped', 'another line to be wrapped'])
        >>> s.str.wrap(12)
        0             line to be\nwrapped
        1    another line\nto be\nwrapped
        dtype: object
        )rCrDZ    _str_wraprE)r3rär5rGr9r9r:Úwraps8zStringMethods.wrapú|)r´cCs$|jj |¡\}}|j||dddS)aS
        Return DataFrame of dummy/indicator variables for Series.
 
        Each string in Series is split by sep and returned as a DataFrame
        of dummy/indicator variables.
 
        Parameters
        ----------
        sep : str, default "|"
            String to split on.
 
        Returns
        -------
        DataFrame
            Dummy variables corresponding to values of the Series.
 
        See Also
        --------
        get_dummies : Convert categorical variable into dummy/indicator
            variables.
 
        Examples
        --------
        >>> pd.Series(['a|b', 'a', 'a|c']).str.get_dummies()
           a  b  c
        0  1  1  0
        1  1  0  0
        2  1  0  1
 
        >>> pd.Series(['a|b', np.nan, 'a|c']).str.get_dummies()
           a  b  c
        0  1  1  0
        1  0  0  0
        2  1  0  1
        TF)r)rdre)rCrDZ_str_get_dummiesrE)r3r´rGr)r9r9r:Ú get_dummiesTs'üzStringMethods.get_dummiescCs|jj |¡}| |¡S)a
        Map all characters in the string through the given mapping table.
 
        Equivalent to standard :meth:`str.translate`.
 
        Parameters
        ----------
        table : dict
            Table is a mapping of Unicode ordinals to Unicode ordinals, strings, or
            None. Unmapped characters are left untouched.
            Characters mapped to None are deleted. :meth:`str.maketrans` is a
            helper function for making translation tables.
 
        Returns
        -------
        Series or Index
        )rCrDZ_str_translaterE)r3ÚtablerGr9r9r:Ú    translateƒszStringMethods.translate©rÍcCs|jj ||¡}|j|ddS)aB
        Count occurrences of pattern in each string of the Series/Index.
 
        This function is used to count the number of times a particular regex
        pattern is repeated in each of the string elements of the
        :class:`~pandas.Series`.
 
        Parameters
        ----------
        pat : str
            Valid regular expression.
        flags : int, default 0, meaning no flags
            Flags for the `re` module. For a complete list, `see here
            <https://docs.python.org/3/howto/regex.html#compilation-flags>`_.
        **kwargs
            For compatibility with other string methods. Not used.
 
        Returns
        -------
        Series or Index
            Same type as the calling object containing the integer counts.
 
        See Also
        --------
        re : Standard library module for regular expressions.
        str.count : Standard library version, without regular expression support.
 
        Notes
        -----
        Some characters need to be escaped when passing in `pat`.
        eg. ``'$'`` has a special meaning in regex and must be escaped when
        finding this literal character.
 
        Examples
        --------
        >>> s = pd.Series(['A', 'B', 'Aaba', 'Baca', np.nan, 'CABA', 'cat'])
        >>> s.str.count('a')
        0    0.0
        1    0.0
        2    2.0
        3    2.0
        4    NaN
        5    0.0
        6    1.0
        dtype: float64
 
        Escape ``'$'`` to find the literal dollar sign.
 
        >>> s = pd.Series(['$', 'B', 'Aab$', '$$ca', 'C$B$', 'cat'])
        >>> s.str.count('\\$')
        0    1
        1    0
        2    1
        3    2
        4    2
        5    0
        dtype: int64
 
        This is also available on Index
 
        >>> pd.Index(['A', 'A', 'Aaba', 'cat']).str.count('a')
        Index([0, 0, 2, 1], dtype='int64')
        Fr)rCrDZ
_str_countrE©r3r¼rÍrGr9r9r:Úcount™sAzStringMethods.countzstr | tuple[str, ...]z Scalar | NonezSeries | Index)r¼rÖr*cCsFt|ttfƒs&dt|ƒj›}t|ƒ‚|jjj||d}|j    |ddS)a|
        Test if the start of each string element matches a pattern.
 
        Equivalent to :meth:`str.startswith`.
 
        Parameters
        ----------
        pat : str or tuple[str, ...]
            Character sequence or tuple of strings. Regular expressions are not
            accepted.
        na : object, default NaN
            Object shown if element tested is not a string. The default depends
            on dtype of the array. For object-dtype, ``numpy.nan`` is used.
            For ``StringDtype``, ``pandas.NA`` is used.
 
        Returns
        -------
        Series or Index of bool
            A Series of booleans indicating whether the given pattern matches
            the start of each string element.
 
        See Also
        --------
        str.startswith : Python standard library string method.
        Series.str.endswith : Same as startswith, but tests the end of string.
        Series.str.contains : Tests if string element contains a pattern.
 
        Examples
        --------
        >>> s = pd.Series(['bat', 'Bear', 'cat', np.nan])
        >>> s
        0     bat
        1    Bear
        2     cat
        3     NaN
        dtype: object
 
        >>> s.str.startswith('b')
        0     True
        1    False
        2    False
        3      NaN
        dtype: object
 
        >>> s.str.startswith(('b', 'B'))
        0     True
        1     True
        2    False
        3      NaN
        dtype: object
 
        Specifying `na` to be `False` instead of `NaN`.
 
        >>> s.str.startswith('b', na=False)
        0     True
        1    False
        2    False
        3    False
        dtype: bool
        ú expected a string or tuple, not ©rÖFr)
rRriÚtuplerãr<r2rCrDZ_str_startswithrE©r3r¼rÖr6rGr9r9r:Ú
startswithÝs
@zStringMethods.startswithcCsFt|ttfƒs&dt|ƒj›}t|ƒ‚|jjj||d}|j    |ddS)ap
        Test if the end of each string element matches a pattern.
 
        Equivalent to :meth:`str.endswith`.
 
        Parameters
        ----------
        pat : str or tuple[str, ...]
            Character sequence or tuple of strings. Regular expressions are not
            accepted.
        na : object, default NaN
            Object shown if element tested is not a string. The default depends
            on dtype of the array. For object-dtype, ``numpy.nan`` is used.
            For ``StringDtype``, ``pandas.NA`` is used.
 
        Returns
        -------
        Series or Index of bool
            A Series of booleans indicating whether the given pattern matches
            the end of each string element.
 
        See Also
        --------
        str.endswith : Python standard library string method.
        Series.str.startswith : Same as endswith, but tests the start of string.
        Series.str.contains : Tests if string element contains a pattern.
 
        Examples
        --------
        >>> s = pd.Series(['bat', 'bear', 'caT', np.nan])
        >>> s
        0     bat
        1    bear
        2     caT
        3     NaN
        dtype: object
 
        >>> s.str.endswith('t')
        0     True
        1    False
        2    False
        3      NaN
        dtype: object
 
        >>> s.str.endswith(('t', 'T'))
        0     True
        1    False
        2     True
        3      NaN
        dtype: object
 
        Specifying `na` to be `False` instead of `NaN`.
 
        >>> s.str.endswith('t', na=False)
        0     True
        1    False
        2    False
        3    False
        dtype: bool
        rrFr)
rRrirrãr<r2rCrDZ _str_endswithrErr9r9r:Úendswith#    s
@zStringMethods.endswithcCs|jj ||¡}|j|ddS)aP
 
        Find all occurrences of pattern or regular expression in the Series/Index.
 
        Equivalent to applying :func:`re.findall` to all the elements in the
        Series/Index.
 
        Parameters
        ----------
        pat : str
            Pattern or regular expression.
        flags : int, default 0
            Flags from ``re`` module, e.g. `re.IGNORECASE` (default is 0, which
            means no flags).
 
        Returns
        -------
        Series/Index of lists of strings
            All non-overlapping matches of pattern or regular expression in each
            string of this Series/Index.
 
        See Also
        --------
        count : Count occurrences of pattern or regular expression in each string
            of the Series/Index.
        extractall : For each string in the Series, extract groups from all matches
            of regular expression and return a DataFrame with one row for each
            match and one column for each group.
        re.findall : The equivalent ``re`` function to all non-overlapping matches
            of pattern or regular expression in string, as a list of strings.
 
        Examples
        --------
        >>> s = pd.Series(['Lion', 'Monkey', 'Rabbit'])
 
        The search for the pattern 'Monkey' returns one match:
 
        >>> s.str.findall('Monkey')
        0          []
        1    [Monkey]
        2          []
        dtype: object
 
        On the other hand, the search for the pattern 'MONKEY' doesn't return any
        match:
 
        >>> s.str.findall('MONKEY')
        0    []
        1    []
        2    []
        dtype: object
 
        Flags can be added to the pattern or regular expression. For instance,
        to find the pattern 'MONKEY' ignoring the case:
 
        >>> import re
        >>> s.str.findall('MONKEY', flags=re.IGNORECASE)
        0          []
        1    [Monkey]
        2          []
        dtype: object
 
        When the pattern matches more than one string in the Series, all matches
        are returned:
 
        >>> s.str.findall('on')
        0    [on]
        1    [on]
        2      []
        dtype: object
 
        Regular expressions are supported too. For instance, the search for all the
        strings ending with the word 'on' is shown next:
 
        >>> s.str.findall('on$')
        0    [on]
        1      []
        2      []
        dtype: object
 
        If the pattern is found more than once in the same string, then a list of
        multiple strings is returned:
 
        >>> s.str.findall('b')
        0        []
        1        []
        2    [b, b]
        dtype: object
        Fr)rCrDZ _str_findallrErr9r9r:Úfindalli    sZzStringMethods.findallzDataFrame | Series | Index)r¼rÍrdr*cCs ddlm}t|tƒstdƒ‚tj||d}|jdkr>tdƒ‚|s`|jdkr`t|jt    ƒr`tdƒ‚|j}t
|ƒ}|jdkpz|}|râd}    t |ƒ}
|j j dkr¦||
|d    } qþ|jj j|||d
} t|tƒrÌ|j} nd} || |
| |d } nt|ƒ}    |jj j|||d
} |j| |    d S) a)
 
        Extract capture groups in the regex `pat` as columns in a DataFrame.
 
        For each subject string in the Series, extract groups from the
        first match of regular expression `pat`.
 
        Parameters
        ----------
        pat : str
            Regular expression pattern with capturing groups.
        flags : int, default 0 (no flags)
            Flags from the ``re`` module, e.g. ``re.IGNORECASE``, that
            modify regular expression matching for things like case,
            spaces, etc. For more details, see :mod:`re`.
        expand : bool, default True
            If True, return DataFrame with one column per capture group.
            If False, return a Series/Index if there is one capture group
            or DataFrame if there are multiple capture groups.
 
        Returns
        -------
        DataFrame or Series or Index
            A DataFrame with one row for each subject string, and one
            column for each group. Any capture group names in regular
            expression pat will be used for column names; otherwise
            capture group numbers will be used. The dtype of each result
            column is always object, even when no match is found. If
            ``expand=False`` and pat has only one capture group, then
            return a Series (if subject is a Series) or Index (if subject
            is an Index).
 
        See Also
        --------
        extractall : Returns all matches (not just the first match).
 
        Examples
        --------
        A pattern with two groups will return a DataFrame with two columns.
        Non-matches will be NaN.
 
        >>> s = pd.Series(['a1', 'b2', 'c3'])
        >>> s.str.extract(r'([ab])(\d)')
            0    1
        0    a    1
        1    b    2
        2  NaN  NaN
 
        A pattern may contain optional groups.
 
        >>> s.str.extract(r'([ab])?(\d)')
            0  1
        0    a  1
        1    b  2
        2  NaN  3
 
        Named groups will become column names in the result.
 
        >>> s.str.extract(r'(?P<letter>[ab])(?P<digit>\d)')
        letter digit
        0      a     1
        1      b     2
        2    NaN   NaN
 
        A pattern with one group will return a DataFrame with one column
        if expand=True.
 
        >>> s.str.extract(r'[ab](\d)', expand=True)
            0
        0    1
        1    2
        2  NaN
 
        A pattern with one group will return a Series if expand=False.
 
        >>> s.str.extract(r'[ab](\d)', expand=False)
        0      1
        1      2
        2    NaN
        dtype: object
        r)r r}rú"pattern contains no capture groupsrkz,only one regex group is supported with IndexN)rrQ)rÍrdr€rA)r„r rRrcrrÐrÑrÒrCrÚ _result_dtypeÚ_get_group_namesrDÚsizeZ _str_extractrrVÚ_get_single_group_namerE)r3r¼rÍrdr r»ÚobjZ result_dtypeZ
returns_dfr)rrGZ result_listZ result_indexr9r9r:ÚextractÆ    sBT 
 
 ÿ
ÿzStringMethods.extractcCst|j||ƒS)aü    
        Extract capture groups in the regex `pat` as columns in DataFrame.
 
        For each subject string in the Series, extract groups from all
        matches of regular expression pat. When each subject string in the
        Series has exactly one match, extractall(pat).xs(0, level='match')
        is the same as extract(pat).
 
        Parameters
        ----------
        pat : str
            Regular expression pattern with capturing groups.
        flags : int, default 0 (no flags)
            A ``re`` module flag, for example ``re.IGNORECASE``. These allow
            to modify regular expression matching for things like case, spaces,
            etc. Multiple flags can be combined with the bitwise OR operator,
            for example ``re.IGNORECASE | re.MULTILINE``.
 
        Returns
        -------
        DataFrame
            A ``DataFrame`` with one row for each match, and one column for each
            group. Its rows have a ``MultiIndex`` with first levels that come from
            the subject ``Series``. The last level is named 'match' and indexes the
            matches in each item of the ``Series``. Any capture group names in
            regular expression pat will be used for column names; otherwise capture
            group numbers will be used.
 
        See Also
        --------
        extract : Returns first match only (not all matches).
 
        Examples
        --------
        A pattern with one group will return a DataFrame with one column.
        Indices with no matches will not appear in the result.
 
        >>> s = pd.Series(["a1a2", "b1", "c1"], index=["A", "B", "C"])
        >>> s.str.extractall(r"[ab](\d)")
                0
        match
        A 0      1
          1      2
        B 0      1
 
        Capture group names are used for column names of the result.
 
        >>> s.str.extractall(r"[ab](?P<digit>\d)")
                digit
        match
        A 0         1
          1         2
        B 0         1
 
        A pattern with two groups will return a DataFrame with two columns.
 
        >>> s.str.extractall(r"(?P<letter>[ab])(?P<digit>\d)")
                letter digit
        match
        A 0          a     1
          1          a     2
        B 0          b     1
 
        Optional groups that do not match are NaN in the result.
 
        >>> s.str.extractall(r"(?P<letter>[ab])?(?P<digit>\d)")
                letter digit
        match
        A 0          a     1
          1          a     2
        B 0          b     1
        C 0        NaN     1
        )Ústr_extractallrY)r3r¼rÍr9r9r:Ú
extractallF
sLzStringMethods.extractalla
    Return %(side)s indexes in each strings in the Series/Index.
 
    Each of returned indexes corresponds to the position where the
    substring is fully contained between [start:end]. Return -1 on
    failure. Equivalent to standard :meth:`str.%(method)s`.
 
    Parameters
    ----------
    sub : str
        Substring being searched.
    start : int
        Left edge index.
    end : int
        Right edge index.
 
    Returns
    -------
    Series or Index of int.
 
    See Also
    --------
    %(also)s
    ÚfindZlowestz/rfind : Return highest indexes in each strings.)r¸rƒrÂ)ròcCsBt|tƒs"dt|ƒj›}t|ƒ‚|jj |||¡}|j|ddS)Núexpected a string object, not Fr)    rRrirãr<r2rCrDZ    _str_findrE©r3Úsubròr¾r6rGr9r9r:r$¯
s
 
 
zStringMethods.findZhighestÚrfindz-find : Return lowest indexes in each strings.cCsDt|tƒs"dt|ƒj›}t|ƒ‚|jjj|||d}|j|ddS©Nr%)ròr¾Fr)    rRrirãr<r2rCrDZ
_str_rfindrEr&r9r9r:r(À
s
 
 
zStringMethods.rfindcCs|jj |¡}| |¡S)a`
        Return the Unicode normal form for the strings in the Series/Index.
 
        For more information on the forms, see the
        :func:`unicodedata.normalize`.
 
        Parameters
        ----------
        form : {'NFC', 'NFKC', 'NFD', 'NFKD'}
            Unicode form.
 
        Returns
        -------
        Series/Index of objects
        )rCrDZ_str_normalizerE)r3ÚformrGr9r9r:Ú    normalizeÑ
szStringMethods.normalizeau
    Return %(side)s indexes in each string in Series/Index.
 
    Each of the returned indexes corresponds to the position where the
    substring is fully contained between [start:end]. This is the same
    as ``str.%(similar)s`` except instead of returning -1, it raises a
    ValueError when the substring is not found. Equivalent to standard
    ``str.%(method)s``.
 
    Parameters
    ----------
    sub : str
        Substring being searched.
    start : int
        Left edge index.
    end : int
        Right edge index.
 
    Returns
    -------
    Series or Index of object
 
    See Also
    --------
    %(also)s
    rVz0rindex : Return highest indexes in each strings.)r¸ZsimilarrƒrÂcCsDt|tƒs"dt|ƒj›}t|ƒ‚|jjj|||d}|j|ddSr))    rRrirãr<r2rCrDZ
_str_indexrEr&r9r9r:rV s
 
zStringMethods.indexÚrindexz.index : Return lowest indexes in each strings.cCsDt|tƒs"dt|ƒj›}t|ƒ‚|jjj|||d}|j|ddSr))    rRrirãr<r2rCrDZ _str_rindexrEr&r9r9r:r, s
 
zStringMethods.rindexcCs|jj ¡}|j|ddS)a
        Compute the length of each element in the Series/Index.
 
        The element may be a sequence (such as a string, tuple or list) or a collection
        (such as a dictionary).
 
        Returns
        -------
        Series or Index of int
            A Series or Index of integer values indicating the length of each
            element in the Series or Index.
 
        See Also
        --------
        str.len : Python built-in function returning the length of an object.
        Series.size : Returns the length of the Series.
 
        Examples
        --------
        Returns the length (number of characters) in a string. Returns the
        number of entries for dictionaries, lists or tuples.
 
        >>> s = pd.Series(['dog',
        ...                 '',
        ...                 5,
        ...                 {'foo' : 'bar'},
        ...                 [2, 3, 5, 7],
        ...                 ('one', 'two', 'three')])
        >>> s
        0                  dog
        1
        2                    5
        3       {'foo': 'bar'}
        4         [2, 3, 5, 7]
        5    (one, two, three)
        dtype: object
        >>> s.str.len()
        0    3.0
        1    0.0
        2    NaN
        3    1.0
        4    4.0
        5    3.0
        dtype: float64
        Fr)rCrDZ_str_lenrErFr9r9r:rx& s. zStringMethods.lena³
    Convert strings in the Series/Index to %(type)s.
    %(version)s
    Equivalent to :meth:`str.%(method)s`.
 
    Returns
    -------
    Series or Index of object
 
    See Also
    --------
    Series.str.lower : Converts all characters to lowercase.
    Series.str.upper : Converts all characters to uppercase.
    Series.str.title : Converts first character of each word to uppercase and
        remaining to lowercase.
    Series.str.capitalize : Converts first character to uppercase and
        remaining to lowercase.
    Series.str.swapcase : Converts uppercase to lowercase and lowercase to
        uppercase.
    Series.str.casefold: Removes all case distinctions in the string.
 
    Examples
    --------
    >>> s = pd.Series(['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe'])
    >>> s
    0                 lower
    1              CAPITALS
    2    this is a sentence
    3              SwApCaSe
    dtype: object
 
    >>> s.str.lower()
    0                 lower
    1              capitals
    2    this is a sentence
    3              swapcase
    dtype: object
 
    >>> s.str.upper()
    0                 LOWER
    1              CAPITALS
    2    THIS IS A SENTENCE
    3              SWAPCASE
    dtype: object
 
    >>> s.str.title()
    0                 Lower
    1              Capitals
    2    This Is A Sentence
    3              Swapcase
    dtype: object
 
    >>> s.str.capitalize()
    0                 Lower
    1              Capitals
    2    This is a sentence
    3              Swapcase
    dtype: object
 
    >>> s.str.swapcase()
    0                 LOWER
    1              capitals
    2    THIS IS A SENTENCE
    3              sWaPcAsE
    dtype: object
    Z casemethodszdict[str, dict[str, str]]Ú    _doc_argsZ    lowercaseÚlower)rãrƒÚversionZ    uppercaseÚupperZ    titlecaseÚtitlezbe capitalizedÚ
capitalizez be swapcasedÚswapcasez be casefoldedÚcasefoldcCs|jj ¡}| |¡Sr`)rCrDZ
_str_lowerrErFr9r9r:r.µ s zStringMethods.lowercCs|jj ¡}| |¡Sr`)rCrDZ
_str_upperrErFr9r9r:r0» s zStringMethods.uppercCs|jj ¡}| |¡Sr`)rCrDZ
_str_titlerErFr9r9r:r1Á s zStringMethods.titlecCs|jj ¡}| |¡Sr`)rCrDZ_str_capitalizerErFr9r9r:r2Ç s zStringMethods.capitalizecCs|jj ¡}| |¡Sr`)rCrDZ _str_swapcaserErFr9r9r:r3Í s zStringMethods.swapcasecCs|jj ¡}| |¡Sr`)rCrDZ _str_casefoldrErFr9r9r:r4Ó s zStringMethods.casefolduï
    Check whether all characters in each string are %(type)s.
 
    This is equivalent to running the Python string method
    :meth:`str.%(method)s` for each element of the Series/Index. If a string
    has zero characters, ``False`` is returned for that check.
 
    Returns
    -------
    Series or Index of bool
        Series or Index of boolean values with the same length as the original
        Series/Index.
 
    See Also
    --------
    Series.str.isalpha : Check whether all characters are alphabetic.
    Series.str.isnumeric : Check whether all characters are numeric.
    Series.str.isalnum : Check whether all characters are alphanumeric.
    Series.str.isdigit : Check whether all characters are digits.
    Series.str.isdecimal : Check whether all characters are decimal.
    Series.str.isspace : Check whether all characters are whitespace.
    Series.str.islower : Check whether all characters are lowercase.
    Series.str.isupper : Check whether all characters are uppercase.
    Series.str.istitle : Check whether all characters are titlecase.
 
    Examples
    --------
    **Checks for Alphabetic and Numeric Characters**
 
    >>> s1 = pd.Series(['one', 'one1', '1', ''])
 
    >>> s1.str.isalpha()
    0     True
    1    False
    2    False
    3    False
    dtype: bool
 
    >>> s1.str.isnumeric()
    0    False
    1    False
    2     True
    3    False
    dtype: bool
 
    >>> s1.str.isalnum()
    0     True
    1     True
    2     True
    3    False
    dtype: bool
 
    Note that checks against characters mixed with any additional punctuation
    or whitespace will evaluate to false for an alphanumeric check.
 
    >>> s2 = pd.Series(['A B', '1.5', '3,000'])
    >>> s2.str.isalnum()
    0    False
    1    False
    2    False
    dtype: bool
 
    **More Detailed Checks for Numeric Characters**
 
    There are several different but overlapping sets of numeric characters that
    can be checked for.
 
    >>> s3 = pd.Series(['23', '³', '⅕', ''])
 
    The ``s3.str.isdecimal`` method checks for characters used to form numbers
    in base 10.
 
    >>> s3.str.isdecimal()
    0     True
    1    False
    2    False
    3    False
    dtype: bool
 
    The ``s.str.isdigit`` method is the same as ``s3.str.isdecimal`` but also
    includes special digits, like superscripted and subscripted digits in
    unicode.
 
    >>> s3.str.isdigit()
    0     True
    1     True
    2    False
    3    False
    dtype: bool
 
    The ``s.str.isnumeric`` method is the same as ``s3.str.isdigit`` but also
    includes other characters that can represent quantities such as unicode
    fractions.
 
    >>> s3.str.isnumeric()
    0     True
    1     True
    2     True
    3    False
    dtype: bool
 
    **Checks for Whitespace**
 
    >>> s4 = pd.Series([' ', '\t\r\n ', ''])
    >>> s4.str.isspace()
    0     True
    1     True
    2    False
    dtype: bool
 
    **Checks for Character Case**
 
    >>> s5 = pd.Series(['leopard', 'Golden Eagle', 'SNAKE', ''])
 
    >>> s5.str.islower()
    0     True
    1    False
    2    False
    3    False
    dtype: bool
 
    >>> s5.str.isupper()
    0    False
    1    False
    2     True
    3    False
    dtype: bool
 
    The ``s5.str.istitle`` method checks for whether all words are in title
    case (whether only the first letter of each word is capitalized). Words are
    assumed to be as any sequence of non-numeric characters separated by
    whitespace characters.
 
    >>> s5.str.istitle()
    0    False
    1     True
    2    False
    3    False
    dtype: bool
    Z    ismethodsZ alphanumericÚisalnum)rãrƒZ
alphabeticÚisalphaÚdigitsÚisdigitÚ
whitespaceÚisspaceÚislowerÚisupperÚistitleÚnumericÚ    isnumericÚdecimalÚ    isdecimal)rI)NNNrž)N)N)rÃT)rÃT)TrNT)TrN)TrN)r¹NrF)ržrÃ)rÃ)rÃ)rÃ)NNN)NNN)r÷)r÷)N)N)N)r )r)N)N)r)rT)r)rN)rN)rN)rN)Jr<Ú
__module__Ú __qualname__rHr[Ú staticmethodrPrbrzr{rEr›r@r¶r#rr·r¿rÆrÈrÊrŸr×rÚrÛrÞrßrårærêrërìrõrörùrrrrr
r r rrrrrrr!r#r$r(r+rVr,rxr-Ú__annotations__r.r0r1r2r3r4rJr5r6r8r:r;r<r=r?rAr9r9r9r:rK“sž
 
(ù< ûhþÿ| æÿÿFþúøÿÿ þÿRüÿÿ    üÿÿ    ?
Aÿ
 ù
+üJþÿ
C KKþÿLýÿÿ
ÿÿ
ÿÿþÿ0ÿ ÿ 
:.
CÿEÿE\ÿOþÿýÿÿýÿÿ
þÿüÿÿ    üÿÿ    3þÿJ ý
ý
ý
      þÿÿÿÿÿÿÿÿÿÿrKrŽri)Úlist_of_columnsr´cCsXzt||ƒ}WnDtk
rR|D]*}tj|dd}|dkr"td|›ƒd‚q"YnX|S)a"
    Auxiliary function for :meth:`str.cat`.
 
    Same signature as cat_core, but handles TypeErrors in concatenation, which
    happen if the arrays in list_of columns have the wrong dtypes or content.
 
    Parameters
    ----------
    list_of_columns : list of numpy arrays
        List of arrays to be concatenated with sep;
        these arrays may not contain NaNs!
    sep : string
        The separator string for concatenating the columns.
 
    Returns
    -------
    nd.array
        The concatenation of list_of_columns with sep.
    Tr\)r+r,zpConcatenation requires list-likes containing only strings (or missing values). Offending values found in column N)Úcat_corer2r    r^)rFr´rGÚcolumnrQr9r9r:r³ sÿü
r³cCsd|dkr$tj|td}tj|ddS|gdt|ƒd}||ddd…<tj|td}tj|ddS)aƒ
    Auxiliary function for :meth:`str.cat`
 
    Parameters
    ----------
    list_of_columns : list of numpy arrays
        List of arrays to be concatenated with sep;
        these arrays may not contain NaNs!
    sep : string
        The separator string for concatenating the columns.
 
    Returns
    -------
    nd.array
        The concatenation of list_of_columns with sep.
    r¡rªrr©r˜rkN)rzZasarrayr²Úsumrx)rFr´Z arr_of_colsZ list_with_sepZ arr_with_sepr9r9r:rG³ srGcCs&ddlm}t|j|ƒr|jStSdSrM)rOrNrRrQr²)rÿrNr9r9r:rÎ s  rz
re.Patternr)r»r*cCs|jrtt|jƒƒSdSdSr`)Ú
groupindexÚnextÚiter©r»r9r9r:rÚ srzlist[Hashable]cs,dd„|j ¡Dƒ‰‡fdd„t|jƒDƒS)z¾
    Get named groups from compiled regex.
 
    Unnamed groups are numbered.
 
    Parameters
    ----------
    regex : compiled regex
 
    Returns
    -------
    list of column labels
    cSsi|]\}}||“qSr9r9)rmÚkÚvr9r9r:rqï sz$_get_group_names.<locals>.<dictcomp>csg|]}ˆ d||¡‘qS)rk)rÊ)rmrÉr~r9r:rwð sz$_get_group_names.<locals>.<listcomp>)rJÚitemsrŠrÒrMr9r~r:rá srrËrcCstj||d}|jdkr tdƒ‚t|tƒr:| ¡jdd}t|ƒ}g}g}|j    j
dk}|  ¡D]t\}}    t|    t ƒr^|sz|f}t | |    ¡ƒD]H\}
} t| t ƒr | f} dd„| Dƒ} | | ¡t||
fƒ} | | ¡qˆq^dd    lm}|j||j    jd
gd }t|ƒ}|j||||d }|S) NrrrT)ZdroprkcSsg|]}|dkrtjn|‘qS)r¡)rzÚNaN)rmÚgroupr9r9r:rw     sz"str_extractall.<locals>.<listcomp>)rgrÚr~)rVrrQ)rÐrÑrÒrrRrZ    to_seriesZ reset_indexrrVrrPriÚ    enumeraterÚappendrr„rgrrrr‘)rÿr¼rÍr»rZ
match_listZ
index_listZis_miZ subject_keyÚsubjectZmatch_iZ match_tupleZna_tupleZ
result_keyrgrVrQrGr9r9r:r"ó s<
 
 
 
 
 ÿr")N)r)@Ú
__future__rrýÚ    functoolsrrÐÚtypingrrrrrrÓÚnumpyrzZ pandas._libsr    Zpandas._typingr
r r r Zpandas.util._decoratorsrZpandas.util._exceptionsrZpandas.core.dtypes.commonrrrrrrrZpandas.core.dtypes.genericrrrrZpandas.core.dtypes.missingrZpandas.core.arrays.arrow.dtyperZpandas.core.baserZpandas.core.constructionrr„r r!r"r#rEZ_cpython_optimized_encodersrür@rJrKr³rGrrrr"r9r9r9r:Ú<module>sp     $             ÿE
$