Login using Social Account
     Continue with GoogleLogin using your credentials
We will also need an imputer for the string categorical columns (the regular SimpleImputer does not work on those):
Now let's create a class named MostFrequentImputer
for the imputer:
class << your code comes here >> (BaseEstimator, TransformerMixin):
def fit(self, X, y=None):
self.most_frequent_ = pd.Series([X[c].value_counts().index[0] for c in X],
index=X.columns)
return self
def transform(self, X, y=None):
return X.fillna(self.most_frequent_)
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Loading comments...