From 7d24265f0fc320f6ba8e8bbc0008696f0aea9754 Mon Sep 17 00:00:00 2001 From: saeid-balaneshin Date: Mon, 24 Jul 2017 16:05:57 -0400 Subject: [PATCH] pandas-0.19 compatibility --- ggplot/ggplot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ggplot/ggplot.py b/ggplot/ggplot.py index ba12a6bd..91d31629 100755 --- a/ggplot/ggplot.py +++ b/ggplot/ggplot.py @@ -599,7 +599,10 @@ def _prep_layer_for_plotting(self, layer, facetgroup): if 'fill' in self._aes: fillcol_raw = self._aes['fill'][:-5] fillcol = self._aes['fill'] - fill_levels = self.data[[fillcol_raw, fillcol]].sort(fillcol_raw)[fillcol].unique() + try: # change in Pandas-0.19 + fill_levels = self.data[[fillcol_raw, fillcol]].sort_values(by=fillcol_raw)[fillcol].unique() + except: # before Pandas-0.19 + fill_levels = self.data[[fillcol_raw, fillcol]].sort(fillcol_raw)[fillcol].unique() else: fill_levels = None return dict(x_levels=self.data[self._aes['x']].unique(), fill_levels=fill_levels, lookups=df)