Skip to content

Commit 369703e

Browse files
author
Brendan Herger
committed
Updating references from replacement to fill_value
1 parent aea73b2 commit 369703e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

sklearn_pandas/categorical_imputer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ def __init__(
5656
self,
5757
missing_values='NaN',
5858
strategy='most_frequent',
59-
replacement=None,
59+
fill_value=None,
6060
copy=True
6161
):
6262
self.missing_values = missing_values
6363
self.copy = copy
64-
self.replacement = replacement
64+
self.fill_value = fill_value
6565
self.strategy = strategy
6666

6767
strategies = ['constant', 'most_frequent']
@@ -70,9 +70,9 @@ def __init__(
7070
'Strategy {0} not in {1}'.format(self.strategy, strategies)
7171
)
7272

73-
if self.strategy == 'constant' and self.replacement is None:
73+
if self.strategy == 'constant' and self.fill_value is None:
7474
raise ValueError(
75-
'Please specify a value for \'replacement\''
75+
'Please specify a value for \'fill_value\''
7676
'when using the constant strategy.'
7777
)
7878

@@ -98,7 +98,7 @@ def fit(self, X, y=None):
9898
if self.strategy == 'most_frequent':
9999
modes = pd.Series(X).mode()
100100
elif self.strategy == 'constant':
101-
modes = np.array([self.replacement])
101+
modes = np.array([self.fill_value])
102102
if modes.shape[0] == 0:
103103
raise ValueError('Data is empty or all values are null')
104104
elif modes.shape[0] > 1:

tests/test_categorical_imputer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def test_custom_replacement(replacement_value, input_type):
148148

149149
Xt = CategoricalImputer(
150150
strategy='fixed_value',
151-
replacement=replacement_value
151+
fill_value=replacement_value
152152
).fit_transform(X)
153153

154154
assert pd.core.common.array_equivalent(np.asarray(X), np.asarray(Xc))

0 commit comments

Comments
 (0)