From 7359cdc48fcf3fa170f2486bb3075c1c17478b3d Mon Sep 17 00:00:00 2001 From: Victor Grau Serrat Date: Wed, 20 Sep 2017 16:20:57 -0600 Subject: [PATCH] fix data.history error with tz-aware dataframe --- catalyst/data/resample.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/catalyst/data/resample.py b/catalyst/data/resample.py index 3154e590..dc325c39 100644 --- a/catalyst/data/resample.py +++ b/catalyst/data/resample.py @@ -156,7 +156,10 @@ class DailyHistoryAggregator(object): cache = self._caches[field] = (session, market_open, {}) _, market_open, entries = cache - market_open = market_open.tz_localize('UTC') + try: + market_open = market_open.tz_localize('UTC') + except TypeError: + market_open = market_open.tz_convert('UTC') if dt != market_open: prev_dt = dt_value - self._one_min else: