pandas.Series.str.isalnum — pandas 3.0.0.dev0+2104.ge637b4290d documentation (original) (raw)

Series.str.isalnum()[source]#

Check whether all characters in each string are alphanumeric.

This is equivalent to running the Python string methodstr.isalnum() 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.

Examples

s1 = pd.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 to false for an alphanumeric check.

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