Skip to content

Commit daa1da9

Browse files
committed
REF: Drop timezone in stats computation for pandas 0.24.2
1 parent 52eb813 commit daa1da9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

backtesting/backtesting.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,8 @@ def _drawdown_duration_peaks(dd, index):
865865
df['Drawdown Duration'] = dd_dur
866866
dd_dur = df['Drawdown Duration']
867867

868-
df.index = data.index
868+
# Strip timezone info, otherwise pandas 0.24.2 errors when filling `s` ahead
869+
df.index = data.index.tz_convert(None)
869870

870871
def _round_timedelta(value, _period=_data_period(df)):
871872
return value.ceil(_period.resolution) if isinstance(value, pd.Timedelta) else value

0 commit comments

Comments
 (0)