@@ -306,7 +306,7 @@ def str_endswith(arr, pat, na=np.nan):
306306
307307
308308def str_replace (arr , pat , repl , n = - 1 , case = None , flags = 0 ):
309- """
309+ r """
310310 Replace occurrences of pattern/regex in the Series/Index with
311311 some other string. Equivalent to :meth:`str.replace` or
312312 :func:`re.sub`.
@@ -598,7 +598,7 @@ def _str_extract_frame(arr, pat, flags=0):
598598
599599
600600def str_extract (arr , pat , flags = 0 , expand = None ):
601- """
601+ r """
602602 For each subject string in the Series, extract groups from the
603603 first match of regular expression pat.
604604
@@ -635,23 +635,23 @@ def str_extract(arr, pat, flags=0, expand=None):
635635 Non-matches will be NaN.
636636
637637 >>> s = Series(['a1', 'b2', 'c3'])
638- >>> s.str.extract('([ab])(\d)')
638+ >>> s.str.extract(r '([ab])(\d)')
639639 0 1
640640 0 a 1
641641 1 b 2
642642 2 NaN NaN
643643
644644 A pattern may contain optional groups.
645645
646- >>> s.str.extract('([ab])?(\d)')
646+ >>> s.str.extract(r '([ab])?(\d)')
647647 0 1
648648 0 a 1
649649 1 b 2
650650 2 NaN 3
651651
652652 Named groups will become column names in the result.
653653
654- >>> s.str.extract('(?P<letter>[ab])(?P<digit>\d)')
654+ >>> s.str.extract(r '(?P<letter>[ab])(?P<digit>\d)')
655655 letter digit
656656 0 a 1
657657 1 b 2
@@ -660,15 +660,15 @@ def str_extract(arr, pat, flags=0, expand=None):
660660 A pattern with one group will return a DataFrame with one column
661661 if expand=True.
662662
663- >>> s.str.extract('[ab](\d)', expand=True)
663+ >>> s.str.extract(r '[ab](\d)', expand=True)
664664 0
665665 0 1
666666 1 2
667667 2 NaN
668668
669669 A pattern with one group will return a Series if expand=False.
670670
671- >>> s.str.extract('[ab](\d)', expand=False)
671+ >>> s.str.extract(r '[ab](\d)', expand=False)
672672 0 1
673673 1 2
674674 2 NaN
@@ -694,7 +694,7 @@ def str_extract(arr, pat, flags=0, expand=None):
694694
695695
696696def str_extractall (arr , pat , flags = 0 ):
697- """
697+ r """
698698 For each subject string in the Series, extract groups from all
699699 matches of regular expression pat. When each subject string in the
700700 Series has exactly one match, extractall(pat).xs(0, level='match')
@@ -728,7 +728,7 @@ def str_extractall(arr, pat, flags=0):
728728 Indices with no matches will not appear in the result.
729729
730730 >>> s = Series(["a1a2", "b1", "c1"], index=["A", "B", "C"])
731- >>> s.str.extractall("[ab](\d)")
731+ >>> s.str.extractall(r "[ab](\d)")
732732 0
733733 match
734734 A 0 1
@@ -737,7 +737,7 @@ def str_extractall(arr, pat, flags=0):
737737
738738 Capture group names are used for column names of the result.
739739
740- >>> s.str.extractall("[ab](?P<digit>\d)")
740+ >>> s.str.extractall(r "[ab](?P<digit>\d)")
741741 digit
742742 match
743743 A 0 1
@@ -746,7 +746,7 @@ def str_extractall(arr, pat, flags=0):
746746
747747 A pattern with two groups will return a DataFrame with two columns.
748748
749- >>> s.str.extractall("(?P<letter>[ab])(?P<digit>\d)")
749+ >>> s.str.extractall(r "(?P<letter>[ab])(?P<digit>\d)")
750750 letter digit
751751 match
752752 A 0 a 1
@@ -755,7 +755,7 @@ def str_extractall(arr, pat, flags=0):
755755
756756 Optional groups that do not match are NaN in the result.
757757
758- >>> s.str.extractall("(?P<letter>[ab])?(?P<digit>\d)")
758+ >>> s.str.extractall(r "(?P<letter>[ab])?(?P<digit>\d)")
759759 letter digit
760760 match
761761 A 0 a 1
0 commit comments