Skip to content

Commit d489885

Browse files
committed
docs: add description of isascii()
1 parent d31faac commit d489885

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pandas/core/strings/accessor.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3320,7 +3320,8 @@ def casefold(self):
33203320
33213321
This is equivalent to running the Python string method
33223322
:meth:`str.%(method)s` for each element of the Series/Index. If a string
3323-
has zero characters, ``False`` is returned for that check.
3323+
has zero characters, ``False`` is returned for that check
3324+
except for the `isascii` method.
33243325
33253326
Returns
33263327
-------
@@ -3333,6 +3334,7 @@ def casefold(self):
33333334
Series.str.isalpha : Check whether all characters are alphabetic.
33343335
Series.str.isnumeric : Check whether all characters are numeric.
33353336
Series.str.isalnum : Check whether all characters are alphanumeric.
3337+
Series.str.isascii : Check whether all characters are ASCII characters.
33363338
Series.str.isdigit : Check whether all characters are digits.
33373339
Series.str.isdecimal : Check whether all characters are decimal.
33383340
Series.str.isspace : Check whether all characters are whitespace.
@@ -3367,6 +3369,13 @@ def casefold(self):
33673369
3 False
33683370
dtype: bool
33693371
3372+
>>> s1.str.isascii()
3373+
0 True
3374+
1 True
3375+
2 True
3376+
3 True
3377+
dtype: bool
3378+
33703379
Note that checks against characters mixed with any additional punctuation
33713380
or whitespace will evaluate to false for an alphanumeric check.
33723381
@@ -3457,6 +3466,7 @@ def casefold(self):
34573466
"""
34583467
_doc_args["isalnum"] = {"type": "alphanumeric", "method": "isalnum"}
34593468
_doc_args["isalpha"] = {"type": "alphabetic", "method": "isalpha"}
3469+
_doc_args["isascii"] = {"type": "ASCII characters", "method": "isascii"}
34603470
_doc_args["isdigit"] = {"type": "digits", "method": "isdigit"}
34613471
_doc_args["isspace"] = {"type": "whitespace", "method": "isspace"}
34623472
_doc_args["islower"] = {"type": "lowercase", "method": "islower"}
@@ -3472,6 +3482,9 @@ def casefold(self):
34723482
isalpha = _map_and_wrap(
34733483
"isalpha", docstring=_shared_docs["ismethods"] % _doc_args["isalpha"]
34743484
)
3485+
isascii = _map_and_wrap(
3486+
"isascii", docstring=_shared_docs["ismethods"] % _doc_args["isascii"]
3487+
)
34753488
isdigit = _map_and_wrap(
34763489
"isdigit", docstring=_shared_docs["ismethods"] % _doc_args["isdigit"]
34773490
)

0 commit comments

Comments
 (0)