我正试图用numPy矩阵在numpy.datetime64中写一个日期。
命令
date_vec[row][ind] = np.datetime64(row[date_ind][ind], dtype='datetime64')返回
TypeError: "Cannot cast NumPy timedelta64 scalar from metadata [us] to according to the rule 'same_kind'"np.datetime64(row[date_ind][ind], dtype='datetime64')返回:
numpy.datetime64('2004-10-19T10:23:54.000000+0200')我遗漏了什么?
发布于 2014-03-10 13:19:09
感谢任何试图帮助我的人:)我刚刚找到了this explanation,简短的解决方案是数组的不同实例化:
date_vec = zeros((MAX_A,NUM_OF_B),dtype=[('i',np.int),('date','datetime64[D]')]) https://stackoverflow.com/questions/22282834
复制相似问题