Fit label encoder. Parameters ---------- y : array-like of shape (n_samples,) Target values. Returns ------- self : returns an instance of self. Fitted label encoder.
(self, y)
| 88 | """ |
| 89 | |
| 90 | def fit(self, y): |
| 91 | """Fit label encoder. |
| 92 | |
| 93 | Parameters |
| 94 | ---------- |
| 95 | y : array-like of shape (n_samples,) |
| 96 | Target values. |
| 97 | |
| 98 | Returns |
| 99 | ------- |
| 100 | self : returns an instance of self. |
| 101 | Fitted label encoder. |
| 102 | """ |
| 103 | y = column_or_1d(y, warn=True) |
| 104 | self.classes_ = _unique(y) |
| 105 | return self |
| 106 | |
| 107 | def fit_transform(self, y): |
| 108 | """Fit label encoder and return encoded labels. |