Skip to content

Commit b7e62c2

Browse files
git add whatsnew and change docstring
1 parent db169c6 commit b7e62c2

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

doc/source/whatsnew/v0.24.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,7 @@ Strings
16671667
- Bug in :meth:`Index.str.split` was not nan-safe (:issue:`23677`).
16681668
- Bug :func:`Series.str.contains` not respecting the ``na`` argument for a ``Categorical`` dtype ``Series`` (:issue:`22158`)
16691669
- Bug in :meth:`Index.str.cat` when the result contained only ``NaN`` (:issue:`24044`)
1670+
- Bug in :func:`Series.str.replace` not applying regex in patterns of length 1 (:issue:`24804`)
16701671

16711672
Interval
16721673
^^^^^^^^

pandas/core/strings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,10 @@ def str_replace(arr, pat, repl, n=-1, case=None, flags=0, regex=None):
456456
flags : int, default 0 (no flags)
457457
- re module flags, e.g. re.IGNORECASE
458458
- Cannot be set if `pat` is a compiled regex
459-
regex : boolean, default True
459+
regex : boolean, default None
460460
- If True, assumes the passed-in pattern is a regular expression.
461461
- If False, treats the pattern as a literal string
462+
- If pat is single special character, default regex is False.
462463
- Cannot be set to False if `pat` is a compiled regex or `repl` is
463464
a callable.
464465

0 commit comments

Comments
 (0)