AttributeError: module 'numpy' has no attribute 'float'

Question:

from sklearn.ensemble import RandomForestClassifier

When i run it in jupyter notebook after adding

module 'numpy' has no attribute 'float'

I am getting an error like this.
library i added
and
the error i got

I was trying to apply random forest, which is a machine learning model. However, it didn’t work and I got such an error and couldn’t solve it. I would appreciate your help.

Asked By: Yakup Akdin

||

Answers:

np.float was removed as of 1.24. It looks like the package you’re using relies on an older version of Numpy. You could either: update sklearn to a newer version that doesn’t use np.float (if it exists) or downgrade your Numpy version to 1.23.5.

Answered By: Matt Eng