@@ -1293,6 +1293,15 @@ def match(self, pat, case: bool = True, flags: int = 0, na=None):
1293
1293
contains : Analogous, but less strict, relying on re.search instead of
1294
1294
re.match.
1295
1295
extract : Extract matched groups.
1296
+
1297
+ Examples
1298
+ --------
1299
+ >>> ser = pd.Series(["horse", "eagle", "donkey"])
1300
+ >>> ser.str.match("e")
1301
+ 0 False
1302
+ 1 True
1303
+ 2 False
1304
+ dtype: bool
1296
1305
"""
1297
1306
result = self ._data .array ._str_match (pat , case = case , flags = flags , na = na )
1298
1307
return self ._wrap_result (result , fill_value = na , returns_string = False )
@@ -1324,6 +1333,15 @@ def fullmatch(self, pat, case: bool = True, flags: int = 0, na=None):
1324
1333
match : Similar, but also returns `True` when only a *prefix* of the string
1325
1334
matches the regular expression.
1326
1335
extract : Extract matched groups.
1336
+
1337
+ Examples
1338
+ --------
1339
+ >>> ser = pd.Series(["cat", "duck", "dove"])
1340
+ >>> ser.str.fullmatch(r'd.+')
1341
+ 0 False
1342
+ 1 True
1343
+ 2 True
1344
+ dtype: bool
1327
1345
"""
1328
1346
result = self ._data .array ._str_fullmatch (pat , case = case , flags = flags , na = na )
1329
1347
return self ._wrap_result (result , fill_value = na , returns_string = False )
@@ -1616,6 +1634,35 @@ def pad(
1616
1634
Returns
1617
1635
-------
1618
1636
Series/Index of objects.
1637
+
1638
+ Examples
1639
+ --------
1640
+ For Series.str.center:
1641
+
1642
+ >>> ser = pd.Series(['dog', 'bird', 'mouse'])
1643
+ >>> ser.str.center(8, fillchar='.')
1644
+ 0 ..dog...
1645
+ 1 ..bird..
1646
+ 2 .mouse..
1647
+ dtype: object
1648
+
1649
+ For Series.str.ljust:
1650
+
1651
+ >>> ser = pd.Series(['dog', 'bird', 'mouse'])
1652
+ >>> ser.str.ljust(8, fillchar='.')
1653
+ 0 dog.....
1654
+ 1 bird....
1655
+ 2 mouse...
1656
+ dtype: object
1657
+
1658
+ For Series.str.rjust:
1659
+
1660
+ >>> ser = pd.Series(['dog', 'bird', 'mouse'])
1661
+ >>> ser.str.rjust(8, fillchar='.')
1662
+ 0 .....dog
1663
+ 1 ....bird
1664
+ 2 ...mouse
1665
+ dtype: object
1619
1666
"""
1620
1667
1621
1668
@Appender (_shared_docs ["str_pad" ] % {"side" : "left and right" , "method" : "center" })
@@ -1867,6 +1914,17 @@ def decode(self, encoding, errors: str = "strict"):
1867
1914
Returns
1868
1915
-------
1869
1916
Series or Index
1917
+
1918
+ Examples
1919
+ --------
1920
+ For Series:
1921
+
1922
+ >>> ser = pd.Series([b'cow', b'123', b'()'])
1923
+ >>> ser.str.decode('ascii')
1924
+ 0 cow
1925
+ 1 123
1926
+ 2 ()
1927
+ dtype: object
1870
1928
"""
1871
1929
# TODO: Add a similar _bytes interface.
1872
1930
if encoding in _cpython_optimized_decoders :
@@ -1895,6 +1953,15 @@ def encode(self, encoding, errors: str = "strict"):
1895
1953
Returns
1896
1954
-------
1897
1955
Series/Index of objects
1956
+
1957
+ Examples
1958
+ --------
1959
+ >>> ser = pd.Series(['cow', '123', '()'])
1960
+ >>> ser.str.encode(encoding='ascii')
1961
+ 0 b'cow'
1962
+ 1 b'123'
1963
+ 2 b'()'
1964
+ dtype: object
1898
1965
"""
1899
1966
result = self ._data .array ._str_encode (encoding , errors )
1900
1967
return self ._wrap_result (result , returns_string = False )
@@ -2730,6 +2797,15 @@ def extractall(self, pat, flags: int = 0) -> DataFrame:
2730
2797
See Also
2731
2798
--------
2732
2799
%(also)s
2800
+
2801
+ Examples
2802
+ --------
2803
+ >>> ser = pd.Series(["cow_", "duck_", "do_ve"])
2804
+ >>> ser.str.find("_")
2805
+ 0 3
2806
+ 1 4
2807
+ 2 2
2808
+ dtype: int64
2733
2809
"""
2734
2810
2735
2811
@Appender (
@@ -2813,6 +2889,15 @@ def normalize(self, form):
2813
2889
See Also
2814
2890
--------
2815
2891
%(also)s
2892
+
2893
+ Examples
2894
+ --------
2895
+ >>> ser = pd.Series(["horse", "eagle", "donkey"])
2896
+ >>> ser.str.index("e")
2897
+ 0 4
2898
+ 1 0
2899
+ 2 4
2900
+ dtype: int64
2816
2901
"""
2817
2902
2818
2903
@Appender (
0 commit comments