pyfolio icon indicating copy to clipboard operation
pyfolio copied to clipboard

conflict about live_start_date/PERIODS/UTC

Open wukan1986 opened this issue 6 years ago • 0 comments

pf.create_full_tear_sheet(
    returns
)

it's right

pf.create_full_tear_sheet(
    returns,
    live_start_date='2016-01-01',
)

TypeError: Cannot compare tz-naive and tz-aware datetime-like objects.

returns.index = returns.index.tz_localize('UTC')
pf.create_full_tear_sheet(
    returns,
    live_start_date='2016-01-01',
)

some events not show, just like 'New Normal' I found in extract_interesting_date_ranges returns_dupe.loc[start:end]

TypeError: Cannot compare tz-naive and tz-aware datetime-like objects.

I have to add tz_localize('UTC') for PERIODS

pf.interesting_periods.PERIODS['New Normal'] = (pd.Timestamp('20130101').tz_localize('UTC'), pd.Timestamp('today').tz_localize('UTC'))

returns.index = returns.index.tz_localize('UTC')
pf.create_full_tear_sheet(
    returns,
    live_start_date='2016-01-01',
)

it's all right!

  • Pyfolio version: install from git, 2020-05-27
  • Python version: 3.7.3
  • Pandas version: 1.0.3

wukan1986 avatar May 27 '20 07:05 wukan1986