You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2017/05/24 21:18:50 UTC

arrow git commit: ARROW-1066: [Python] pandas 0.20.1 deprecation of pd.lib causes a warning on import

Repository: arrow
Updated Branches:
  refs/heads/master 3d8b1906b -> 40b1b6431


ARROW-1066: [Python] pandas 0.20.1 deprecation of pd.lib causes a warning on import

Author: Jeff Reback <je...@twosigma.com>

Closes #715 from jreback/pandas_compat and squashes the following commits:

842b19f [Jeff Reback] COMPAT: pandas 0.20.1 deprecation of pd.lib causes a warning on import


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/40b1b643
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/40b1b643
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/40b1b643

Branch: refs/heads/master
Commit: 40b1b643170f8a97e011255d24ffbb944a5a229b
Parents: 3d8b190
Author: Jeff Reback <je...@twosigma.com>
Authored: Wed May 24 17:18:45 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Wed May 24 17:18:45 2017 -0400

----------------------------------------------------------------------
 python/pyarrow/feather.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/40b1b643/python/pyarrow/feather.py
----------------------------------------------------------------------
diff --git a/python/pyarrow/feather.py b/python/pyarrow/feather.py
index 34783a7..9f40ab4 100644
--- a/python/pyarrow/feather.py
+++ b/python/pyarrow/feather.py
@@ -26,6 +26,11 @@ from pyarrow.lib import FeatherError  # noqa
 from pyarrow.lib import Table
 import pyarrow.lib as ext
 
+try:
+    infer_dtype = pdapi.infer_dtype
+except AttributeError:
+    infer_dtype = pd.lib.infer_dtype
+
 
 if LooseVersion(pd.__version__) < '0.17.0':
     raise ImportError("feather requires pandas >= 0.17.0")
@@ -75,7 +80,7 @@ class FeatherWriter(object):
             col = df.iloc[:, i]
 
             if pdapi.is_object_dtype(col):
-                inferred_type = pd.lib.infer_dtype(col)
+                inferred_type = infer_dtype(col)
                 msg = ("cannot serialize column {n} "
                        "named {name} with dtype {dtype}".format(
                            n=i, name=name, dtype=inferred_type))
@@ -83,7 +88,7 @@ class FeatherWriter(object):
                 if inferred_type in ['mixed']:
 
                     # allow columns with nulls + an inferable type
-                    inferred_type = pd.lib.infer_dtype(col[col.notnull()])
+                    inferred_type = infer_dtype(col[col.notnull()])
                     if inferred_type in ['mixed']:
                         raise ValueError(msg)