From 9ff440918888d4e038b4437df85dd90511c76ed6 Mon Sep 17 00:00:00 2001 From: Kevin Sheppard Date: Wed, 8 Jan 2025 15:40:08 +0000 Subject: [PATCH] MAINT: Update for MPL changes --- arch/tests/unitroot/test_unitroot.py | 6 +++++- arch/univariate/base.py | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/tests/unitroot/test_unitroot.py b/arch/tests/unitroot/test_unitroot.py index f447866730..ab64899166 100644 --- a/arch/tests/unitroot/test_unitroot.py +++ b/arch/tests/unitroot/test_unitroot.py @@ -15,7 +15,11 @@ import scipy.stats as stats from statsmodels.datasets import macrodata, modechoice, nile, randhie, sunspots from statsmodels.regression.linear_model import OLS -from statsmodels.tsa.stattools import _autolag, lagmat +from statsmodels.tsa.stattools import lagmat +try: + from statsmodels.tsa.stattools import _autolag +except: + from statsmodels.tsa.stattools._stattools import _autolag from arch.unitroot import ADF, DFGLS, KPSS, PhillipsPerron, VarianceRatio, ZivotAndrews from arch.unitroot.critical_values.dickey_fuller import tau_2010 diff --git a/arch/univariate/base.py b/arch/univariate/base.py index 4103c6f087..c0ffe5f2a3 100644 --- a/arch/univariate/base.py +++ b/arch/univariate/base.py @@ -45,8 +45,13 @@ ) from arch.utility.testing import WaldTestStatistic +MPL_LT_310 = False try: from matplotlib.figure import Figure + from matplotlib import __version__ + from packaging.version import Version + + MPL_LT_310 = Version(__version__) < Version("3.10.0") except ImportError: pass @@ -1642,7 +1647,7 @@ def hedgehog_plot( fig, ax = plt.subplots(1, 1) use_date = isinstance(self._dep_var.index, pd.DatetimeIndex) - plot_fn = ax.plot_date if use_date else ax.plot + plot_fn = ax.plot_date if use_date and MPL_LT_310 else ax.plot x_values = np.array(self._dep_var.index) if plot_mean: y_values = np.asarray(self._dep_var)