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

Check whether all characters in each string are alphanumeric.

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


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

Note that checks against characters mixed with any additional punctuation or whitespace will evaluate too false for an alphanumeric check.

>>> s2 = ps.Series(['A B', '1.5', '3,000'])
>>> s2.str.isalnum()
0    False
1    False
2    False
dtype: bool