Skip to content

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

@Mo-Iravani

Description

@Mo-Iravani

Problem Description

ttributeError Traceback (most recent call last)
in
----> 1 pf.create_full_tear_sheet(data['return'])

~\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)
209 turnover_denom=turnover_denom,
210 header_rows=header_rows,
--> 211 set_context=set_context)
212
213 create_interesting_times_tear_sheet(returns,

~\anaconda3\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)

~\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)
502 header_rows=header_rows)
503
--> 504 plotting.show_worst_drawdown_periods(returns)
505
506 vertical_sections = 11

~\anaconda3\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),

~\anaconda3\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