Skip to content

Commit

Permalink
Bump minimum pandas version to v0.21.0
Browse files Browse the repository at this point in the history
And fix deprecations.

closes has2k1#73
  • Loading branch information
has2k1 committed Oct 30, 2017
1 parent 520cc09 commit 4ccc954
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions plotnine/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import, unicode_literals
import os

import pandas as pd
import os
from pandas.api.types import CategoricalDtype

__all__ = ['diamonds', 'economics', 'economics_long',
'midwest', 'mpg', 'msleep', 'presidential',
Expand Down Expand Up @@ -43,14 +44,14 @@ def _ordered_categories(df, categories):
the ordered category list
"""
for col, cats in categories.items():
df[col] = df[col].astype('category', categories=cats, ordered=True)
df[col] = df[col].astype(CategoricalDtype(cats, ordered=True))
return df


def _unordered_categories(df, columns):
"""Make the columns in df categorical"""
for col in columns:
df[col] = df[col].astype('category', ordered=False)
df[col] = df[col].astype(CategoricalDtype(ordered=False))
return df


Expand Down
8 changes: 4 additions & 4 deletions plotnine/facets/facet_wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ def compute_layout(self, data):
# The bottom-most row of each column and the left most
# column of each row
if self.as_table or self.dir == 'h':
x_idx = [df['ROW'].argmax() for _, df in layout.groupby('COL')]
y_idx = [df['COL'].argmin() for _, df in layout.groupby('ROW')]
x_idx = [df['ROW'].idxmax() for _, df in layout.groupby('COL')]
y_idx = [df['COL'].idxmin() for _, df in layout.groupby('ROW')]
else:
x_idx = [df['ROW'].argmin() for _, df in layout.groupby('COL')]
y_idx = [df['COL'].argmax() for _, df in layout.groupby('ROW')]
x_idx = [df['ROW'].idxmin() for _, df in layout.groupby('COL')]
y_idx = [df['COL'].idxmax() for _, df in layout.groupby('ROW')]

layout['AXIS_X'] = False
layout['AXIS_Y'] = False
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_required_packages():
'scipy',
'patsy >= 0.4.1',
'statsmodels >= 0.8.0',
'pandas >= 0.20.1',
'pandas >= 0.21.0',
]
return install_requires

Expand Down

0 comments on commit 4ccc954

Please sign in to comment.