Skip to content

Commit

Permalink
Converting mode references to most_frequent
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendan Herger committed Aug 9, 2018
1 parent d1e8fae commit a6296a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sklearn_pandas/categorical_imputer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CategoricalImputer(BaseEstimator, TransformerMixin):
def __init__(
self,
missing_values='NaN',
strategy='mode',
strategy='most_frequent',
replacement=None,
copy=True
):
Expand All @@ -64,7 +64,7 @@ def __init__(
self.replacement = replacement
self.strategy = strategy

strategies = ['fixed_value', 'mode']
strategies = ['fixed_value', 'most_frequent']
if self.strategy not in strategies:
raise ValueError(
'Strategy {0} not in {1}'.format(self.strategy, strategies)
Expand Down Expand Up @@ -95,7 +95,7 @@ def fit(self, X, y=None):

mask = _get_mask(X, self.missing_values)
X = X[~mask]
if self.strategy == 'mode':
if self.strategy == 'most_frequent':
modes = pd.Series(X).mode()
elif self.strategy == 'fixed_value':
modes = np.array([self.replacement])
Expand Down

0 comments on commit a6296a3

Please sign in to comment.