@@ -39,11 +39,11 @@ def __init__(self, verbose=0, cols=None, drop_invariant=False,
3939 (otherwise it will be a numpy array).
4040 handle_missing: str
4141 how to handle missing values at fit time. Options are 'error', 'return_nan',
42- and 'value'. Default 'value', which treat NaNs as a countable category at
42+ and 'value'. Default 'value', which treat nans as a countable category at
4343 fit time.
4444 handle_unknown: str, int or dict of {column : option, ...}.
4545 how to handle unknown labels at transform time. Options are 'error'
46- 'return_nan', 'value' and int. Defaults to None which uses NaN behaviour
46+ 'return_nan', 'value' and int. Defaults to None which uses nan behaviour
4747 specified at fit time. Passing an int will fill with this int value.
4848 normalize: bool or dict of {column : bool, ...}.
4949 whether to normalize the counts to the range (0, 1). See Pandas `value_counts`
@@ -62,9 +62,9 @@ def __init__(self, verbose=0, cols=None, drop_invariant=False,
6262 Note: The default name can be long and may keep changing, for example,
6363 in cross-validation.
6464 combine_min_nan_groups: bool or dict of {column : bool, ...}.
65- whether to combine the leftovers group with NaN group. Default True. Can
65+ whether to combine the leftovers group with nan group. Default True. Can
6666 also be forced to combine with 'force' meaning small groups are effectively
67- counted as NaNs . Force can only be used when 'handle_missing' is 'value' or 'error'.
67+ counted as nans . Force can only be used when 'handle_missing' is 'value' or 'error'.
6868 Note: Will not force if it creates a binary or invariant column.
6969
7070
@@ -137,7 +137,7 @@ def _fit(self, X, y=None, **kwargs):
137137 def _transform (self , X ):
138138 for col in self .cols :
139139 # Treat None as np.nan
140- X [col ] = pd .Series ([el if el is not None else np .NaN for el in X [col ]], index = X [col ].index )
140+ X [col ] = pd .Series ([el if el is not None else np .nan for el in X [col ]], index = X [col ].index )
141141 if self .handle_missing == "value" :
142142 if not util .is_category (X [col ].dtype ):
143143 X [col ] = X [col ].fillna (np .nan )
@@ -180,7 +180,7 @@ def _fit_count_encode(self, X_in, y):
180180 self .mapping [col ] = mapping_values
181181
182182 if self ._handle_missing [col ] == 'return_nan' :
183- self .mapping [col ][np .NaN ] = np .NaN
183+ self .mapping [col ][np .nan ] = np .nan
184184
185185 # elif self._handle_missing[col] == 'value':
186186 #test_count.py failing self.mapping[col].loc[-2] = 0
0 commit comments