当前位置 博文首页 > 司夏的博客:如何处理 ‘numpy.generic‘ 对象的 ‘属性 ‘dtype

    司夏的博客:如何处理 ‘numpy.generic‘ 对象的 ‘属性 ‘dtype

    作者:[db:作者] 时间:2021-07-29 09:45

    运行如下命令

    data.info() 
    pd.Series(pos_k,index=range(1,11)).plot()
    

    显示此错误

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

    TypeError: 无法将 ‘numpy.generic’ objects>’ 的 '<attribute ‘dtype’ 解释为数据类型

    这就是我修复它的方式:

    1. 升级numpy版本:

    pip install numpy --upgrade
    

    2. 升级pandas版本

    pip install pandas --upgrade
    

    重新启动即可运行。

    该问题是由 numpy 和 pandas [1] 的版本引起的:https : //pandas.pydata.org/pandas-docs/stable/getting_started/install.html

    cs