package sklearn

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `Make_column_selector
]
type t = [ `Make_column_selector | `Object ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val create : ?pattern:string -> ?dtype_include:[ `Dtype of Np.Dtype.t | `Dtypes of Np.Dtype.t list ] -> ?dtype_exclude:[ `Dtype of Np.Dtype.t | `Dtypes of Np.Dtype.t list ] -> unit -> t

Create a callable to select columns to be used with :class:`ColumnTransformer`.

:func:`make_column_selector` can select columns based on datatype or the columns name with a regex. When using multiple selection criteria, **all** criteria must match for a column to be selected.

Parameters ---------- pattern : str, default=None Name of columns containing this regex pattern will be included. If None, column selection will not be selected based on pattern.

dtype_include : column dtype or list of column dtypes, default=None A selection of dtypes to include. For more details, see :meth:`pandas.DataFrame.select_dtypes`.

dtype_exclude : column dtype or list of column dtypes, default=None A selection of dtypes to exclude. For more details, see :meth:`pandas.DataFrame.select_dtypes`.

Returns ------- selector : callable Callable for column selection to be used by a :class:`ColumnTransformer`.

See also -------- sklearn.compose.ColumnTransformer : Class that allows combining the outputs of multiple transformer objects used on column subsets of the data into a single feature space.

Examples -------- >>> from sklearn.preprocessing import StandardScaler, OneHotEncoder >>> from sklearn.compose import make_column_transformer >>> from sklearn.compose import make_column_selector >>> import pandas as pd # doctest: +SKIP >>> X = pd.DataFrame('city': ['London', 'London', 'Paris', 'Sallisaw'], ... 'rating': [5, 3, 4, 5]) # doctest: +SKIP >>> ct = make_column_transformer( ... (StandardScaler(), ... make_column_selector(dtype_include=np.number)), # rating ... (OneHotEncoder(), ... make_column_selector(dtype_include=object))) # city >>> ct.fit_transform(X) # doctest: +SKIP array([ 0.90453403, 1. , 0. , 0. ], [-1.50755672, 1. , 0. , 0. ], [-0.30151134, 0. , 1. , 0. ], [ 0.90453403, 0. , 0. , 1. ])

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.