pyspark.pandas.Series.str.isnumeric

str.isnumeric() → pyspark.pandas.series.Series

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.

Examples

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

The s2.str.isdecimal method checks for characters used to form numbers in base 10.

>>> s2.str.isdecimal()
0     True
1    False
2    False
3    False
dtype: bool

The s2.str.isdigit method is the same as s2.str.isdecimal but also includes special digits, like superscripted and subscripted digits in Unicode.

>>> s2.str.isdigit()
0     True
1     True
2    False
3    False
dtype: bool

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

>>> s2.str.isnumeric()
0     True
1     True
2     True
3    False
dtype: bool