TypeError: Cannot interpret ‘<attribute ‘dtype‘ of ‘numpy.generic‘ objects>‘ as a data type

1.在使用df.info()时报错:TypeError: Cannot interpret ‘<attribute ‘dtype‘ of ‘numpy.generic‘objects>‘as a data type;我搜索了很长时间,发现好像是numpy和pandas版本的问题,我尝试了更新,最后不仅没成功还浪费了我很多时间,而且中间还出现另一个错误:ModuleNotFoundError: No module named ‘pandas.compat‘,这个错误还是pandas的问题。

2.最后我直接cmd卸载了pandas,然后重装。

# 删除pandas
pip uninstall pandas
# 重装
pip install pandas

3.重装之后可能还会出现第一个错误,然后再更新pandas。

pip install -U pandas

然后问题解决了。

你可能感兴趣的:(numpy,python,开发语言)