Skip to content

Commit ac32ce8

Browse files
gfyoungjreback
authored andcommitted
TST: Escape invalid escape characters (#21154)
Partially addresses gh-21137.
1 parent 81358e8 commit ac32ce8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/strings.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def str_count(arr, pat, flags=0):
241241
Escape ``'$'`` to find the literal dollar sign.
242242
243243
>>> s = pd.Series(['$', 'B', 'Aab$', '$$ca', 'C$B$', 'cat'])
244-
>>> s.str.count('\$')
244+
>>> s.str.count('\\$')
245245
0 1
246246
1 0
247247
2 1
@@ -358,7 +358,7 @@ def str_contains(arr, pat, case=True, flags=0, na=np.nan, regex=True):
358358
359359
Returning any digit using regular expression.
360360
361-
>>> s1.str.contains('\d', regex=True)
361+
>>> s1.str.contains('\\d', regex=True)
362362
0 False
363363
1 False
364364
2 False

0 commit comments

Comments
 (0)