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 2019/09/15 15:46:11 UTC

[arrow] branch master updated: ARROW-6561: [Python] Fix python tests to pass on pandas master

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 8d9ba8e  ARROW-6561: [Python] Fix python tests to pass on pandas master
8d9ba8e is described below

commit 8d9ba8ecb7ea44210444ab94665dd41324bc3dd1
Author: Joris Van den Bossche <jo...@gmail.com>
AuthorDate: Sun Sep 15 10:46:02 2019 -0500

    ARROW-6561: [Python] Fix python tests to pass on pandas master
    
    https://issues.apache.org/jira/browse/ARROW-6561
    
    Closes #5384 from jorisvandenbossche/ARROW-6561-pandas-master-integration and squashes the following commits:
    
    c88d20f60 <Joris Van den Bossche> ARROW-6561:  Fix python tests to pass on pandas master
    
    Authored-by: Joris Van den Bossche <jo...@gmail.com>
    Signed-off-by: Wes McKinney <we...@apache.org>
---
 python/pyarrow/tests/test_pandas.py | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/python/pyarrow/tests/test_pandas.py b/python/pyarrow/tests/test_pandas.py
index fe5853f..2ee8c1e 100644
--- a/python/pyarrow/tests/test_pandas.py
+++ b/python/pyarrow/tests/test_pandas.py
@@ -3025,18 +3025,14 @@ def test_array_protocol():
     if LooseVersion(pd.__version__) < '0.24.0':
         pytest.skip('IntegerArray only introduced in 0.24')
 
-    def __arrow_array__(self, type=None):
-        return pa.array(self._data, mask=self._mask, type=type)
-
     df = pd.DataFrame({'a': pd.Series([1, 2, None], dtype='Int64')})
 
-    # with latest pandas/arrow, trying to convert nullable integer errors
-    with pytest.raises(TypeError):
-        pa.table(df)
-
-    try:
-        # patch IntegerArray with the protocol
-        pd.arrays.IntegerArray.__arrow_array__ = __arrow_array__
+    if LooseVersion(pd.__version__) < '0.26.0.dev':
+        # with pandas<=0.25, trying to convert nullable integer errors
+        with pytest.raises(TypeError):
+            pa.table(df)
+    else:
+        # __arrow_array__ added to pandas IntegerArray in 0.26.0.dev
 
         # default conversion
         result = pa.table(df)
@@ -3061,9 +3057,6 @@ def test_array_protocol():
         result = pa.array(df['a'].values, type=pa.float64())
         assert result.equals(expected2)
 
-    finally:
-        del pd.arrays.IntegerArray.__arrow_array__
-
 
 # ----------------------------------------------------------------------
 # Legacy metadata compatibility tests