AttributeError: 'NoneType' object has no attribute 'transform'

Good day!
Hi! I was implementing a pipeline that would be doing some transformations and then later pick the top 5 features based on feature importance. When I later applied the fit_transform on my data, I got the following error:

AttributeError: 'NoneType' object has no attribute 'transform'

but the code runs fine if I apply fit and transform sequentially.

!

Please show more code and add mission link as well.

Without further information I guess you may have forgot to return classifier in fit method. The method should return the object ( self ).

    def fit(self, x, y=None):
        # ...
        # ...
        return self
1 Like

Thanks a ton Dishin!!

1 Like