在用matplotlib 中的 直方图(hist) 进行数据可视化时,报错—TypeError: ‘numpy.float64’ object cannot be interpreted as an integer,是因为hist要求数据类型为int类型,
解决方案:进行数据类型转换即可。如:df[‘price’]=df.price.astype(int)
TypeError: 'numpy.float64' object cannot be interpreted as an integer
最新推荐文章于 2024-04-12 19:05:11 发布
本文解决了一个常见的matplotlib直方图绘制错误:TypeError,原因是数据类型不匹配。详细介绍了如何将数据从float类型转换为int类型,以确保hist函数正常工作。

3600

被折叠的 条评论
为什么被折叠?



