diff --git a/doc/source/user_guide/text.rst b/doc/source/user_guide/text.rst index 9dd4fb68ae26a..9b1c9b8d04270 100644 --- a/doc/source/user_guide/text.rst +++ b/doc/source/user_guide/text.rst @@ -302,10 +302,10 @@ positional argument (a regex object) and return a string. return m.group(0)[::-1] - pd.Series( - ["foo 123", "bar baz", np.nan], - dtype="string" - ).str.replace(pat, repl, regex=True) + pd.Series(["foo 123", "bar baz", np.nan], dtype="string").str.replace( + pat, repl, regex=True + ) + # Using regex groups pat = r"(?P\w+) (?P\w+) (?P\w+)"