AttributeError:“numpy.int64”对象没有属性“to_pydatetime”

Jac*_*Law 4 python datetime attributes numpy

我是Python新手。我已经开始使用 pyfolio 库,当我输入以下代码时

pf.create_returns_tear_sheet(data['New_Adjusted_Returns'],benchmark_rets=None)
Run Code Online (Sandbox Code Playgroud)

出现如下错误:

AttributeError: 'numpy.int64' object has no attribute 'to_pydatetime'
Run Code Online (Sandbox Code Playgroud)

data['New_Adjusted_Returns'] 由以下数据组成:

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.
Run Code Online (Sandbox Code Playgroud)

Ano*_*gra 11

通过更改文件 timeseries.py 中的第 893 行修复了此问题

valley = underwater.index[np.argmin(underwater)] # end of the period
Run Code Online (Sandbox Code Playgroud)