hipdf.core.column.string.StringMethods.filter_alphanum

hipdf.core.column.string.StringMethods.filter_alphanum#

21 min read time

Applies to Linux

StringMethods.filter_alphanum(repl: str | None = None, keep: bool = True) SeriesOrIndex#

Remove non-alphanumeric characters from strings in this column.

Parameters#

replstr

Optional string to use in place of removed characters.

keepbool

Set to False to remove all alphanumeric characters instead of keeping them.

Returns#

Series/Index of str dtype

Strings with only alphanumeric characters.

Examples#

>>> import cudf
>>> s = cudf.Series(["pears £12", "plums $34", "Temp 72℉", "100K℧"])
>>> s.str.filter_alphanum(" ")
0    pears  12
1    plums  34
2     Temp 72
3        100K
dtype: object