简体   繁体   English

AttributeError:模块'numpy'没有属性'float'

[英]AttributeError: module 'numpy' has no attribute 'float'

from sklearn.ensemble import RandomForestClassifier

When i run it in jupyter notebook after adding当我添加后在 jupyter notebook 中运行它时

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.我在尝试应用随机森林,这是一个机器学习 model。但是,它没有用,我得到了这样的错误,无法解决。 I would appreciate your help.我将不胜感激你的帮助。

np.float was removed as of 1.24. np.float 从 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.看起来您正在使用的 package 依赖于 Numpy 的旧版本。您可以:将 sklearn 更新为不使用 np.float(如果存在)的较新版本或将 Numpy 版本降级为 1.23.5。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM