Skip to content

'numpy.int64' object has no attribute 'to_pydatetime' #652

Open
@euribate

Description

@euribate

Problem Description

I got the following errorn when I run create_full_tear_sheet from pyfolio. can anybody help as I cannot use Pyfolio.

The following are the packages version I have installed:
python 3.6
pandas 1.0.5
numpy 1.18.5
pyfolio 0.9.2
empyrical 0.5.3

the following is the full error I got
AttributeError Traceback (most recent call last)
in
----> 1 pf.create_returns_tear_sheet(Globale)

~\Miniconda3\envs\lavoro\lib\site-packages\pyfolio\plotting.py in call_w_context(*args, **kwargs)
50 if set_context:
51 with plotting_context(), axes_style():
---> 52 return func(*args, **kwargs)
53 else:
54 return func(*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)
502 header_rows=header_rows)
503
--> 504 plotting.show_worst_drawdown_periods(returns)
505
506 vertical_sections = 11

~\Miniconda3\envs\lavoro\lib\site-packages\pyfolio\plotting.py in show_worst_drawdown_periods(returns, top)
1662 """
1663
-> 1664 drawdown_df = timeseries.gen_drawdown_table(returns, top=top)
1665 utils.print_table(
1666 drawdown_df.sort_values('Net drawdown in %', ascending=False),

~\Miniconda3\envs\lavoro\lib\site-packages\pyfolio\timeseries.py in gen_drawdown_table(returns, top)
1006 df_drawdowns.loc[i, 'Peak date'] = (peak.to_pydatetime()
1007 .strftime('%Y-%m-%d'))
-> 1008 df_drawdowns.loc[i, 'Valley date'] = (valley.to_pydatetime()
1009 .strftime('%Y-%m-%d'))
1010 if isinstance(recovery, float):

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions