Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'numpy.int64' object has no attribute 'to_pydatetime'

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'] 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.
like image 600
Jacky Law Avatar asked Sep 07 '25 11:09

Jacky Law


1 Answers

fixed this by changing line 893 in file timeseries.py

valley = underwater.index[np.argmin(underwater)] # end of the period
like image 188
Anoop Jangra Avatar answered Sep 10 '25 11:09

Anoop Jangra