Transformer
ColumnSelect
Column selection transformer.
Quickstart
python
from sktime.transformations.subset import ColumnSelect
estimator = ColumnSelect(columns=None, integer_treatment='col', index_treatment='remove')Parameters(3)
- columnspandas compatible index or index coercible, optional, default = None
- columns to which X in transform is to be subset
- integer_treatmentstr, optional, one of “col” (default) and “coerce”
- determines how integer index columns are treated “col” = subsets by column iloc index, even if columns is not in X.columns “coerce” = coerces to integer pandas.Index and attempts to subset
- index_treatmentstr, optional, one of “remove” (default) or “keep”
determines which column are kept in
Xt = transform(X, y)“remove” = only indices that appear in both X and columns are present in Xt. “keep” = all indices in columns appear in Xt. If not present in X, NA is filled.
Examples
>>> from sktime.transformations.subset import ColumnSelect
>>> from sktime.datasets import load_longley
>>> X = load_longley ()[1 ]
>>> transformer = ColumnSelect (columns = ["GNPDEFL", "POP", "FOO" ])
>>> X_subset = transformer. fit_transform (X = X)