AttributeError:"numpy.int64"对象没有属性"to_pydatetime" [英] AttributeError: 'numpy.int64' object has no attribute 'to_pydatetime'
本文介绍了AttributeError:"numpy.int64"对象没有属性"to_pydatetime"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Python的新手.我已经开始使用pyfolio库,并且当我输入以下代码时
I am new to Python. I have started to use pyfolio library and when I typed the following code
pf.create_returns_tear_sheet(data['New_Adjusted_Returns'],benchmark_rets=None)
发生了一个名为的错误,如下所示:
An error named occurred as follow:
AttributeError: 'numpy.int64' object has no attribute 'to_pydatetime'
data ['New_Adjusted_Returns']由以下数据组成:
data['New_Adjusted_Returns'] consists of the following data:
Date
2020-02-14 -0.004500
2020-02-17 -0.022107
2020-02-18 -0.000029
2020-02-19 -0.000800
2020-02-20 -0.017102
2020-02-21 -0.000028
2020-02-24 0.014400
2020-02-25 0.007900
2020-02-26 -0.001000
2020-02-27 -0.000517
2020-02-28 -0.000029
Would someone be able to help me on this issue? Thank you very much.
推荐答案
通过更改文件timeseries.py中的第893行来解决此问题.
fixed this by changing line 893 in file timeseries.py
valley = underwater.index[np.argmin(underwater)] # end of the period
这篇关于AttributeError:"numpy.int64"对象没有属性"to_pydatetime"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文