maxframe.dataframe.Series.str.isdigit#

Series.str.isdigit()#

检查每个字符串中的所有字符是否都是数字。

这等效于对 Series/Index 的每个元素运行 Python 字符串方法 str.isdigit()。如果字符串没有字符,则该检查返回 False

返回:

与原始 Series/Index 长度相同的布尔值 Series 或 Index。

返回类型:

Series or Index of bool

参见

Series.str.isalpha

检查所有字符是否都是字母。

Series.str.isnumeric

检查所有字符是否都是数值。

Series.str.isalnum

检查所有字符是否都是字母或数字。

Series.str.isdecimal

检查所有字符是否都是十进制数。

Series.str.isspace

检查所有字符是否都是空白字符。

Series.str.islower

检查所有字符是否都是小写。

Series.str.isascii

Check whether all characters are ascii.

Series.str.isupper

检查所有字符是否都是大写。

Series.str.istitle

检查所有字符是否都是标题格式(首字母大写)。

备注

Similar to str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode.

The exact behavior of this method, i.e. which unicode characters are considered as digits, depends on the backend used for string operations, and there can be small differences. For example, Python considers the ³ superscript character as a digit, but not the ⅕ fraction character, while PyArrow considers both as digits. For simple (ascii) decimal numbers, the behaviour is consistent.

示例

>>> import maxframe.dataframe as md
>>> s3 = md.Series(["23", "³", "⅕", ""])
>>> s3.str.isdigit().execute()
0     True
1     True
2     True
3    False
dtype: bool