diff --git a/ggplot/stats/smoothers.py b/ggplot/stats/smoothers.py index 5a8fbf37..2198a3f8 100644 --- a/ggplot/stats/smoothers.py +++ b/ggplot/stats/smoothers.py @@ -1,7 +1,7 @@ from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np -from pandas.lib import Timestamp +from pandas import Timestamp import pandas as pd import statsmodels.api as sm from statsmodels.nonparametric.smoothers_lowess import lowess as smlowess @@ -11,7 +11,7 @@ import datetime date_types = ( - pd.tslib.Timestamp, + pd.Timestamp, pd.DatetimeIndex, pd.Period, pd.PeriodIndex, diff --git a/ggplot/stats/stat_smooth.py b/ggplot/stats/stat_smooth.py index 2264a6aa..5611438d 100644 --- a/ggplot/stats/stat_smooth.py +++ b/ggplot/stats/stat_smooth.py @@ -55,8 +55,6 @@ class stat_smooth(geom): def plot(self, ax, data, _aes): (data, _aes) = self._update_data(data, _aes) variables = _aes.data - data = data[list(variables.values())] - data = data.dropna() x = data[variables['x']] y = data[variables['y']] @@ -76,10 +74,7 @@ def plot(self, ax, data, _aes): x, y, y1, y2 = smoothers.lowess(x, y, span=span) smoothed_data = pd.DataFrame(dict(x=x, y=y, y1=y1, y2=y2)) - try: # change in Pandas-0.19 - smoothed_data = smoothed_data.sort_values(by='x') - except: # before Pandas-0.19 - smoothed_data = smoothed_data.sort('x') + smoothed_data = smoothed_data.sort('x') params = self._get_plot_args(data, _aes) if 'alpha' not in params: diff --git a/ggplot/themes/theme_538.py b/ggplot/themes/theme_538.py index d9182f25..20452837 100644 --- a/ggplot/themes/theme_538.py +++ b/ggplot/themes/theme_538.py @@ -1,8 +1,6 @@ from __future__ import (absolute_import, division, print_function, unicode_literals) -from cycler import cycler from .theme import theme_base -from cycler import cycler class theme_538(theme_base): """ diff --git a/ggplot/utils.py b/ggplot/utils.py index d0d5dfb6..6c9a92f7 100644 --- a/ggplot/utils.py +++ b/ggplot/utils.py @@ -78,7 +78,7 @@ def is_iterable(obj): return False date_types = ( - pd.tslib.Timestamp, + pd.Timestamp, pd.DatetimeIndex, pd.Period, pd.PeriodIndex,