pandas_select.sklearn.ColumnSelector¶
-
class
ColumnSelector
(selector)[source]¶ Create a callable compatible with
sklearn.compose.ColumnTransformer
.- Parameters
selector – A label selector, i.e. a
callable()
that returns a list of strings.- Raises
ValueError: – If selector is not a callable or doesn’t target the “columns” axis.
Examples
>>> from pandas_select import AnyOf, AllBool, AllNominal, AllNumeric, ColumnSelector >>> from sklearn.compose import make_column_transformer >>> from sklearn.preprocessing import OneHotEncoder, StandardScaler >>> make_column_transformer( ... (StandardScaler(), ColumnSelector(AllNumeric() & ~AnyOf("Generation"))), ... (OneHotEncoder(), ColumnSelector(AllNominal() | AllBool() | "Generation")) ... )