Skip to content

Commit 71223d3

Browse files
update docstring and add note about differences in behaviour
1 parent f455e92 commit 71223d3

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

pandas/core/strings/accessor.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3610,10 +3610,19 @@ def casefold(self):
36103610
>>> s3 = pd.Series(['23', '³', '⅕', ''])
36113611
>>> s3.str.isdigit()
36123612
0 True
3613-
1 False
3614-
2 False
3613+
1 True
3614+
2 True
36153615
3 False
36163616
dtype: bool
3617+
3618+
Notes
3619+
-----
3620+
The exact behavior of this method, i.e. which unicode characters are
3621+
considered as digits, depends on the backend used for string operations,
3622+
and there can be small differences.
3623+
For example, Python considers the ³ superscript character as a digit, but
3624+
not the ⅕ fraction character, while PyArrow considers both as digits. For
3625+
simple (ascii) decimal numbers, the behaviour is consistent.
36173626
"""
36183627

36193628
_shared_docs["isspace"] = """

pandas/tests/strings/test_strings.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
import numpy as np
88
import pytest
99

10-
from pandas.compat import pa_version_under21p0
11-
from pandas.errors import Pandas4Warning
10+
from pandas.compat import (
11+
Pandas4Warning,
12+
pa_version_under21p0,
13+
)
1214

1315
from pandas import (
1416
NA,

0 commit comments

Comments
 (0)