categorical#

skrub.selectors.categorical()[source]#

Select columns that have a Categorical (or polars Enum) data type.

Examples

>>> from skrub import selectors as s
>>> import pandas as pd
>>> df = pd.DataFrame(
...     dict(
...         string=pd.Series(['A', 'B']),
...         category=pd.Series(['A', 'B'], dtype="category"),
...     )
... )
>>> df
  string category
0      A        A
1      B        B
>>> df.dtypes
string        object
category    category
dtype: object
>>> s.select(df, s.categorical())
  category
0        A
1        B