ValueError:缓冲区dtype不匹配,应为'float64_t',但为'float' [英] ValueError: Buffer dtype mismatch, expected 'float64_t' but got 'float'
本文介绍了ValueError:缓冲区dtype不匹配,应为'float64_t',但为'float'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个DataFrame'modtso':
There is a DataFrame 'modtso':
In [4]: modtso
Out[4]:
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 74006 entries, 2002-07-27 15:00:00 to 2010-12-31 22:58:08
Data columns:
0 74006 non-null values
dtypes: float32(1)
In [5]: modtso[1:10]
Out[5]:
0
2002-07-27 16:01:53 9.336845
2002-07-27 16:58:08 9.337487
2002-07-27 18:00:00 9.343308
2002-07-27 19:01:53 9.364368
2002-07-27 19:58:08 9.389445
...
现在,我想按以下方式对其进行重新采样:
Now I want to resample it as below:
a=modtso.resample('D',how='std')
它将引发异常:
ValueError: Buffer dtype mismatch, expected 'float64_t' but got 'float'
出什么问题了?我该如何解决? 谢谢
what's the problem? how can I fix it? thanks
推荐答案
0.11-dev完全支持 在0.10中,我认为它可以工作,但是您的float32对于几乎所有操作都将变为float64
this is fully supported on 0.11-dev in 0.10 I think it will work, but your float32 will become float64 for almost any operation
和FYI可以显式转换类型
and FYI to convert types explicitly
df.astype('float64')
在此处查看示例 http://pandas.pydata.org /pandas-docs/dev/whatsnew.html#v0-11-0-march-2013
这篇关于ValueError:缓冲区dtype不匹配,应为'float64_t',但为'float'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文