scipy.stats numpy.core._exceptions._UFuncBinaryResolutionError: ufunc 'add' 不能使用类型为 dtype('<M8[ns]') 和 dtype('<M8[ns]') 的操作数

问题描述

我愿意使用 scipy.stats 计算 netcdf 文件的趋势。每次我运行这个代码片段时:

decltype

我遇到以下错误

    import scipy.stats
    slope0      =  np.zeros(GDI[0,:,:].shape)
    intercept0  =  np.zeros(GDI[0,:].shape)
    r_value0    =  np.zeros(GDI[0,:].shape)
    p_value0    =  np.zeros(GDI[0,:].shape)
    std_err0    =  np.zeros(GDI[0,:].shape)
    nlon=len(lon)
    nlat=len(lat)
    ntime=len(time)
    for ilat in range(nlat):
    for jlon in range(nlon): 
    slope0[jlon,ilat],intercept0[jlon,r_value0[jlon,p_value0[jlon,std_err0[jlon,std_err = scipy.stats.linregress(time,GDI[:,jlon,ilat])
 

我的数据遵循以下结构:

numpy.core._exceptions._UFuncBinaryResolutionError: ufunc 'add' cannot use operands with types dtype('<M8[ns]') and dtype('<M8[ns]')` 

我曾尝试使用论坛中提出的一些解决方案,但无济于事。请问谁能有想法帮我解决这个问题???

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)