MAINT: Protect loader against Series saved with no tz.

Checking for tz.UTC is not sufficient, since it is possible for
the index.tz value to be None.
This commit is contained in:
Eddie Hebert
2013-11-11 14:17:14 -05:00
parent 408c129760
commit 89793e371c
+10 -2
View File
@@ -162,11 +162,19 @@ Fetching data from Yahoo Finance.
# we have data,then we need to update
if len(trading_days) - last_bm_date_offset > 1:
benchmark_returns = update_benchmarks(bm_symbol, last_bm_date)
if benchmark_returns.index.tz.zone != 'UTC':
if (
benchmark_returns.index.tz is None
or
benchmark_returns.index.zone != 'UTC'
):
benchmark_returns = benchmark_returns.tz_localize('UTC')
else:
benchmark_returns = saved_benchmarks
if benchmark_returns.index.tz.zone != 'UTC':
if (
benchmark_returns.index.tz is None
or
benchmark_returns.index.zone != 'UTC'
):
benchmark_returns = benchmark_returns.tz_localize('UTC')
try: