New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'numpy.int64' object has no attribute 'to_pydatetime' #520
Comments
I see the same error. I updated to the latest version of pyfolio and still the error doesn't go away. T |
I see this error as well. It was introduced by empyrical 0.4.0. Downgrading empyrical resolves the error:
|
I think the issue here is that On 0.3.4 I see:
On 0.4.0 I see:
|
Tentative bugfix PR here: https://github.com/quantopian/empyrical/compare/fix-cum_returns-index?expand=1. |
Hi, I tried to downgrade empyrical to 0.3.4 but it didn't solve the error. Is there any new progress on this issue? |
As mentioned by ssanderson, there’s a bug with cum returns. I’d suggest go into the scrip and change the code manually. Worked for me on ep 0.4.0. Find def cum_returns, change the code as suggested in the link, and reload module. |
Thanks |
Was this fix already merged? When I load the link it says there is nothing to compare and therefore can't see the fix. |
It was merged: quantopian/empyrical#85, but I don't think the fixed empyrical has been released to PyPI yet. |
Correct - I just took the code out of the merge although it isn't in the
release as you said.
Kind regards,
James Tromans
…On Wed, Mar 7, 2018 at 9:56 PM, Richard Frank ***@***.***> wrote:
It was merged: quantopian/empyrical#85
<quantopian/empyrical#85>, but I don't think the
fixed empyrical has been released to PyPI yet.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#520 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABE_j-EkeqzuVaSI3uvdAZGfE_A1y1E8ks5tcFd0gaJpZM4SSHeH>
.
|
I just released empyrical 0.4.1, which has the required bugfix. If you run into this issue with empyrical >=0.4.1, please let us know here. |
How do I resolve this ? AttributeError Traceback (most recent call last) C:\ProgramData\Anaconda3\lib\site-packages\pyfolio\tears.py in create_full_tear_sheet(returns, positions, transactions, market_data, benchmark_rets, slippage, live_start_date, sector_mappings, bayesian, round_trips, estimate_intraday, hide_positions, cone_std, bootstrap, unadjusted_returns, style_factor_panel, sectors, caps, shares_held, volumes, percentile, turnover_denom, set_context, factor_returns, factor_loadings, pos_in_dollars, header_rows, factor_partitions) C:\ProgramData\Anaconda3\lib\site-packages\pyfolio\plotting.py in call_w_context(*args, **kwargs) C:\ProgramData\Anaconda3\lib\site-packages\pyfolio\tears.py in create_returns_tear_sheet(returns, positions, transactions, live_start_date, cone_std, benchmark_rets, bootstrap, turnover_denom, header_rows, return_fig) C:\ProgramData\Anaconda3\lib\site-packages\pyfolio\plotting.py in show_worst_drawdown_periods(returns, top) C:\ProgramData\Anaconda3\lib\site-packages\pyfolio\timeseries.py in gen_drawdown_table(returns, top) AttributeError: 'datetime.date' object has no attribute 'to_pydatetime' |
I am having the same problem with |
I have the same problem. pyfolio 0.9.2, empyrical 0.5.3 |
seems this has been fixed in #634 |
@stnatter Hi Stephen. Your suggestion worked like a charm. I appreciate it. |
I am getting this error (empirical 0.5.3) when I run this line of code: AttributeError Traceback (most recent call last) /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyfolio/tears.py in create_full_tear_sheet(returns, positions, transactions, market_data, benchmark_rets, slippage, live_start_date, sector_mappings, bayesian, round_trips, estimate_intraday, hide_positions, cone_std, bootstrap, unadjusted_returns, style_factor_panel, sectors, caps, shares_held, volumes, percentile, turnover_denom, set_context, factor_returns, factor_loadings, pos_in_dollars, header_rows, factor_partitions) /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyfolio/plotting.py in call_w_context(*args, **kwargs) /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyfolio/tears.py in create_returns_tear_sheet(returns, positions, transactions, live_start_date, cone_std, benchmark_rets, bootstrap, turnover_denom, header_rows, return_fig) /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyfolio/plotting.py in show_worst_drawdown_periods(returns, top) /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyfolio/timeseries.py in gen_drawdown_table(returns, top) AttributeError: 'numpy.int64' object has no attribute 'to_pydatetime' |
Same here |
Fixed by using:
This has been fixed in #634 as stated by stnatter above. |
I already install the git+, but still not fix this problem |
Same problem.=my error message = AttributeError: 'numpy.int64' object has no attribute 'to_pydatetime'=my conda list= |
Same problem here
pandas 1.0.5 |
To fix the error, if working on Google Colab, use:
|
Cool seems to work now. @VHKA1729 , I think I was doing this before. Not sure what changed, but thanks anyway 👍
|
Hmmm im still getting that error - even running the patch:
|
Hi all I getting the same issue, is anybody looking at this? with this error I cannot use pyfolio. I got the foloowing error: AttributeError Traceback (most recent call last) ~\Miniconda3\envs\lavoro\lib\site-packages\pyfolio\tears.py in create_full_tear_sheet(returns, positions, transactions, market_data, benchmark_rets, slippage, live_start_date, sector_mappings, bayesian, round_trips, estimate_intraday, hide_positions, cone_std, bootstrap, unadjusted_returns, style_factor_panel, sectors, caps, shares_held, volumes, percentile, turnover_denom, set_context, factor_returns, factor_loadings, pos_in_dollars, header_rows, factor_partitions) ~\Miniconda3\envs\lavoro\lib\site-packages\pyfolio\plotting.py in call_w_context(*args, **kwargs) ~\Miniconda3\envs\lavoro\lib\site-packages\pyfolio\tears.py in create_returns_tear_sheet(returns, positions, transactions, live_start_date, cone_std, benchmark_rets, bootstrap, turnover_denom, header_rows, return_fig) ~\Miniconda3\envs\lavoro\lib\site-packages\pyfolio\plotting.py in show_worst_drawdown_periods(returns, top) ~\Miniconda3\envs\lavoro\lib\site-packages\pyfolio\timeseries.py in gen_drawdown_table(returns, top) AttributeError: 'numpy.int64' object has no attribute 'to_pydatetime' |
This seems to work for me 'pip install git+https://github.com/quantopian/pyfolio' as mentioned above. |
Dear Ariel, I tried but got the same message. While installing "pip install git+https://github.com/quantopian/pyfolio" i got this message: Collecting git+https://github.com/quantopian/pyfolio Running command git clone -q https://github.com/quantopian/pyfolio 'C:\Users\u19040\AppData\Local\Temp\pip-req-build-8_z5l1d7' |
Dear Ariel, I tried but got the same message. While installing "pip install git+https://github.com/quantopian/pyfolio" i got this message: Collecting git+https://github.com/quantopian/pyfolio Running command git clone -q https://github.com/quantopian/pyfolio 'C:\Users\u19040\AppData\Local\Temp\pip-req-build-8_z5l1d7' |
It says you may not have git and need to install it, also if you're on python3 use pip3 |
I tried not working...Now I am trying to install different version of Python and numpy/pandas. Do you know if with a particolar version pyfolio work? or it is just a waste of time? |
for the benefit of all, I tried with python 3.7 and the 'pip install git+https://github.com/quantopian/pyfolio' and it is working |
I've already installed 'pip install git+https://github.com/quantopian/pyfolio' and I'm using versions: pandas 1.0.5 But I'm having problems with charts as you can see in the images bellow. Someone can help me? |
fixed this by changing line 893 in file timeseries.py |
Thanks Anoop. Fixed it. |
Fixed: |
Hi @Ramoncontabil How did you fix it? I replace lines 1008 to 1016 with what you wrote but I still have the issue, what versions should I have why is this not working I also replace line 893 and the error says is on line 1008 |
same thing. reproducable.
|
Para corrigir o erro, basta alterar a linha nº 893 do código de timeseries.py na def get_max_drawdown_underwater(underwater): |
x2, but with pandas==2.1.3 |
occurs when trying to run an example from the docs
The text was updated successfully, but these errors were encountered: