from nose import SkipTest from numpy.testing import assert_ from statsmodels.tsa.base.datetools import dates_from_range from statsmodels.tsa.x13 import _find_x12, x13_arima_select_order x13path = _find_x12() if x13path is False: _have_x13 = False else: _have_x13 = True class TestX13(object): @classmethod def setupClass(cls): if not _have_x13: raise SkipTest("X13/X12 not available") import pandas as pd from statsmodels.datasets import macrodata, co2 dta = macrodata.load_pandas().data dates = dates_from_range("1959Q1", "2009Q3") index = pd.DatetimeIndex(dates) dta.index = index cls.quarterly_data = dta.dropna() dta = co2.load_pandas().data dta["co2"] = dta.co2.interpolate()
import pandas as pd import pytest from statsmodels.datasets import macrodata, co2 from statsmodels.tsa.x13 import (_find_x12, x13_arima_select_order, x13_arima_analysis) x13path = _find_x12() pytestmark = pytest.mark.skipif(x13path is False, reason='X13/X12 not available') dta = macrodata.load_pandas().data index = pd.period_range(start='1959Q1', end='2009Q3', freq='Q') dta.index = index quarterly_data = dta.dropna() dta = co2.load_pandas().data dta['co2'] = dta.co2.interpolate() monthly_data = dta.resample('M') # change in pandas 0.18 resample is deferred object if not isinstance(monthly_data, (pd.DataFrame, pd.Series)): monthly_data = monthly_data.mean() monthly_start_data = dta.resample('MS') if not isinstance(monthly_start_data, (pd.DataFrame, pd.Series)): monthly_start_data = monthly_start_data.mean() data = (monthly_data, monthly_start_data, monthly_data.co2, monthly_start_data.co2, quarterly_data.realgdp, quarterly_data[['realgdp']])