_LabelEncoder

class _LabelEncoder[source]

Bases: sklearn.preprocessing._label.LabelEncoder

Inherited-members

Methods

fit(y)

Fit label encoder.

fit_transform(y)

Fit label encoder and return encoded labels.

get_params([deep])

Get parameters for this estimator.

inverse_transform(y)

Transform labels back to original encoding.

set_params(**params)

Set the parameters of this estimator.

transform(y, strategy)

Transform labels to normalized encoding.

fit(y)

Fit label encoder.

Parameters

y (array-like of shape (n_samples,)) – Target values.

Returns

self – Fitted label encoder.

Return type

returns an instance of self.

fit_transform(y)

Fit label encoder and return encoded labels.

Parameters

y (array-like of shape (n_samples,)) – Target values.

Returns

y – Encoded labels.

Return type

array-like of shape (n_samples,)

get_params(deep=True)

Get parameters for this estimator.

Parameters

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params – Parameter names mapped to their values.

Return type

dict

inverse_transform(y)

Transform labels back to original encoding.

Parameters

y (ndarray of shape (n_samples,)) – Target values.

Returns

y – Original encoding.

Return type

ndarray of shape (n_samples,)

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters

**params (dict) – Estimator parameters.

Returns

self – Estimator instance.

Return type

estimator instance

transform(y: pandas.core.series.Series, strategy: str)[source]

Transform labels to normalized encoding.

Parameters
  • y (array-like of shape (n_samples,)) – Target values.

  • strategy (str) –

Returns

y – Labels as normalized encodings.

Return type

array-like of shape (n_samples,)