From 14e293d28bcd7335f562a3ca63bec85005d06d28 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Wed, 6 Aug 2014 16:21:06 +0200 Subject: [PATCH] TST: fix _infer_freq for pandas .14+ compat pandas 0.14 fixed a bug with DatetimeIndex's freqstr attribute. Previously relied on having the freqstr attribute implying that freqstr was not none. --- statsmodels/tsa/base/datetools.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/statsmodels/tsa/base/datetools.py b/statsmodels/tsa/base/datetools.py index 4bc73f7618f..8463d6ad30e 100644 --- a/statsmodels/tsa/base/datetools.py +++ b/statsmodels/tsa/base/datetools.py @@ -281,8 +281,9 @@ def _add_datetimes(dates): return reduce(lambda x, y: y+x, dates) def _infer_freq(dates): - if hasattr(dates, "freqstr"): - return dates.freqstr + maybe_freqstr = getattr(dates, 'freqstr', None) + if maybe_freqstr is not None: + return maybe_freqstr try: from pandas.tseries.api import infer_freq freq = infer_freq(dates)