我有这样的数据
bid
time
2016-05-22 21:05:57.651 18.32280
2016-05-22 21:06:58.005 18.32280
2016-05-22 21:17:30.739 18.31820
2016-05-22 21:17:34.121 18.31820
...当我试图
df_ohlcMXN = dfmxn.resample('5Min').ohlc()我犯了个错误
pandas.core.base.DataError: No numeric types to aggregate发布于 2016-05-23 04:20:48
我认为这意味着您的bid不是正确的数据类型。
当您执行dfmxn.dtypes时,如果您看到object用于Bid,则需要像这样转换它:
dfmxn['Bid'] = dfmxn['Bid'].astype('float64')
dfmxn.resample('5Min').ohlc()为我制作了这个:
Bid
open high low close
Time
2016-05-22 21:05:00 18.3228 18.3228 18.3228 18.3228
2016-05-22 21:10:00 NaN NaN NaN NaN
2016-05-22 21:15:00 18.3182 18.3182 18.3182 18.3182https://stackoverflow.com/questions/37382270
复制相似问题