ColumnSelector Class

Selects a set of columns to retrain, dropping all others.

Inheritance
nimbusml.internal.core.preprocessing.schema._columnselector.ColumnSelector
ColumnSelector
nimbusml.base_transform.BaseTransform
ColumnSelector
sklearn.base.TransformerMixin
ColumnSelector

Constructor

ColumnSelector(keep_columns=None, drop_columns=None, keep_hidden=False, ignore_missing=False, columns=None, **params)

Parameters

columns

a list of strings representing the column names to perform the transformation on.

The << operator can be used to set this value (see Column Operator)

For example

  • ColumnSelector(columns=['education', 'age'])

  • ColumnSelector() << ['education', 'age']

For more details see Columns.

keep_columns

List of columns to keep.

drop_columns

List of columns to drop.

keep_hidden

Specifies whether to keep or remove hidden columns.

ignore_missing

Specifies whether to ignore columns that are missing from the input.

params

Additional arguments sent to compute engine.

Examples


   ###############################################################################
   # ColumnSelector
   from nimbusml import FileDataStream
   from nimbusml.datasets import get_dataset
   from nimbusml.preprocessing.schema import ColumnSelector

   # data input (as a FileDataStream)
   path = get_dataset('infert').as_filepath()

   data = FileDataStream.read_csv(path, sep=',')

   # transform usage
   xf = ColumnSelector(columns=['education', 'age'])

   # fit and transform
   features = xf.fit_transform(data)

   # print features
   print(features.head())
   #   age education
   # 0   26    0-5yrs
   # 1   42    0-5yrs
   # 2   39    0-5yrs
   # 3   34    0-5yrs
   # 4   35   6-11yrs

Methods

get_params

Get the parameters for this operator.

get_params

Get the parameters for this operator.

get_params(deep=False)

Parameters

deep
default value: False