Skip to content

Commit ef3bdc9

Browse files
In pandas 0.22 series changes behavior of mode method. This is a fix to mantain the same behavior in categorical imputer
1 parent d238936 commit ef3bdc9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sklearn_pandas/categorical_imputer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ def fit(self, X, y=None):
100100
elif self.strategy == 'fixed_value':
101101
modes = np.array([self.replacement])
102102
if modes.shape[0] == 0:
103+
raise ValueError('Data is empty or all values are null')
104+
elif modes.shape[0] > 1:
103105
raise ValueError('No value is repeated more than '
104106
'once in the column')
105107
else:

0 commit comments

Comments
 (0)