Blob Blame History Raw
From f1dc8979b09bc1736149993f895943b3158ee2db Mon Sep 17 00:00:00 2001
From: Ralf Gommers <ralf.gommers@gmail.com>
Date: Wed, 21 Oct 2015 22:05:52 +0200
Subject: [PATCH] MAINT: fix graphics module for changes in recent pandas
 versions.

---
 statsmodels/graphics/tests/test_mosaicplot.py | 2 +-
 statsmodels/graphics/tests/test_tsaplots.py   | 6 +++---
 statsmodels/graphics/tsaplots.py              | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/statsmodels/graphics/tests/test_mosaicplot.py b/statsmodels/graphics/tests/test_mosaicplot.py
index cb9bbbe..e41020e 100644
--- a/statsmodels/graphics/tests/test_mosaicplot.py
+++ b/statsmodels/graphics/tests/test_mosaicplot.py
@@ -113,7 +113,7 @@ def test_mosaic():
     # sort by the marriage quality and give meaningful name
     # [rate_marriage, age, yrs_married, children,
     # religious, educ, occupation, occupation_husb]
-    datas = datas.sort(['rate_marriage', 'religious'])
+    datas = datas.sort_values(by=['rate_marriage', 'religious'])
     num_to_desc = {1: 'awful', 2: 'bad', 3: 'intermediate',
                       4: 'good', 5: 'wonderful'}
     datas['rate_marriage'] = datas['rate_marriage'].map(num_to_desc)
diff --git a/statsmodels/graphics/tests/test_tsaplots.py b/statsmodels/graphics/tests/test_tsaplots.py
index 511f18f..365be82 100644
--- a/statsmodels/graphics/tests/test_tsaplots.py
+++ b/statsmodels/graphics/tests/test_tsaplots.py
@@ -1,4 +1,4 @@
-from statsmodels.compat.python import lmap, lzip, map
+from statsmodels.compat.python import lmap, map
 import numpy as np
 import pandas as pd
 from numpy.testing import dec
@@ -51,8 +51,8 @@ def test_plot_month():
     dta = sm.datasets.elnino.load_pandas().data
     dta['YEAR'] = dta.YEAR.astype(int).apply(str)
     dta = dta.set_index('YEAR').T.unstack()
-    dates = lmap(lambda x : pd.datetools.parse('1 '+' '.join(x)),
-                                            dta.index.values)
+    dates = lmap(lambda x : pd.datetools.parse_time_string('1 '+' '.join(x))[0],
+                                                           dta.index.values)
 
     # test dates argument
     fig = month_plot(dta.values, dates=dates, ylabel='el nino')
diff --git a/statsmodels/graphics/tsaplots.py b/statsmodels/graphics/tsaplots.py
index 3d04692..94626c9 100644
--- a/statsmodels/graphics/tsaplots.py
+++ b/statsmodels/graphics/tsaplots.py
@@ -200,7 +200,7 @@ def seasonal_plot(grouped_x, xticklabels, ylabel=None, ax=None):
     ticks = []
     for season, df in grouped_x:
         df = df.copy() # or sort balks for series. may be better way
-        df.sort()
+        df.sort_values(inplace=True)
         nobs = len(df)
         x_plot = np.arange(start, start + nobs)
         ticks.append(x_plot.mean())