cudf.core.column.string.StringMethods.isnumeric#

StringMethods.isnumeric() SeriesOrIndex#

Check whether all characters in each string are numeric.

This is equivalent to running the Python string method str.isnumeric() for each element of the Series/Index. If a string has zero characters, False is returned for that check.

Returns
Series or Index of bool

Series or Index of boolean values with the same length as the original Series/Index.

See also

isalnum

Check whether all characters are alphanumeric.

isalpha

Check whether all characters are alphabetic.

isdecimal

Check whether all characters are decimal.

isdigit

Check whether all characters are digits.

isinteger

Check whether all characters are integer.

isfloat

Check whether all characters are float.

islower

Check whether all characters are lowercase.

isspace

Check whether all characters are whitespace.

isupper

Check whether all characters are uppercase.

Examples

>>> import cudf
>>> s1 = cudf.Series(['one', 'one1', '1', ''])
>>> s1.str.isnumeric()
0    False
1    False
2     True
3    False
dtype: bool

The s1.str.isnumeric method is the same as s2.str.isdigit but also includes other characters that can represent quantities such as unicode fractions.

>>> s2 = pd.Series(['23', '³', '⅕', ''], dtype='str')
>>> s2.str.isnumeric()
0     True
1     True
2     True
3    False
dtype: bool