为了账号安全,请及时绑定邮箱和手机立即绑定

三次样条插值仅产生nans或引发错误

三次样条插值仅产生nans或引发错误

慕码人2483693 2021-04-02 15:11:08
我正在尝试将数据帧从过时地降到每月。i = ['2000-01-01','2000-04-01','2000-07-01','2000-10-01','2001-01-01','2001-04-01','2001-07-01','2001-10-01']d = [0,54957.84767,0,0,0,56285.54879,0,0]df = pd.DataFrame(index=i, data=d)df.index = pd.to_datetime(df.index,infer_datetime_format=True)df.index = df.index.to_period('Q')df.resample('M').interpolate(method='cubic')这将引发TypeError:TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''如果我跳过这一行:    df.index = df.index.to_period('Q')然后它会产生nans
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 362 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号