maxframe.dataframe.Series.str.isnumeric#
- Series.str.isnumeric()#
检查每个字符串中的所有字符是否都是数字。
这等效于对 Series/Index 的每个元素运行 Python 字符串方法
str.isnumeric()。如果字符串没有字符,则该检查返回False。参见
Series.str.isalpha检查所有字符是否都是字母。
Series.str.isalnum检查所有字符是否都是字母或数字。
Series.str.isdigit检查所有字符是否都是数字。
Series.str.isdecimal检查所有字符是否都是十进制数字。
Series.str.isspace检查所有字符是否都是空白字符。
Series.str.islower检查所有字符是否都是小写。
Series.str.isasciiCheck whether all characters are ascii.
Series.str.isupper检查所有字符是否都是大写。
Series.str.istitle检查所有字符是否都是标题格式(首字母大写)。
示例
s.str.isnumeric方法与s3.str.isdigit相同,但还包括其他可以表示数量的字符,例如 Unicode 分数。>>> import maxframe.dataframe as md >>> s1 = md.Series(["one", "one1", "1", "", "³", "⅕"]) >>> s1.str.isnumeric().execute() 0 False 1 False 2 True 3 False 4 True 5 True dtype: bool
For a string to be considered numeric, all its characters must have a Unicode numeric property matching
str.is_numeric(). As a consequence, the following cases are not recognized as numeric:Decimal numbers (e.g., "1.1"): due to period
"."Negative numbers (e.g., "-5"): due to minus sign
"-"Scientific notation (e.g., "1e3"): due to characters like
"e"
>>> s2 = md.Series(["1.1", "-5", "1e3"]) >>> s2.str.isnumeric().execute() 0 False 1 False 2 False dtype: bool