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/04/30 14:38:29 UTC

[arrow] branch master updated: ARROW-5237: [Python] populate _pandas_api.version

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 f958ba2  ARROW-5237: [Python] populate _pandas_api.version
f958ba2 is described below

commit f958ba29e21c009145e569e3b42d6443bd7e778f
Author: Joris Van den Bossche <jo...@gmail.com>
AuthorDate: Tue Apr 30 09:38:22 2019 -0500

    ARROW-5237: [Python] populate _pandas_api.version
    
    https://issues.apache.org/jira/browse/ARROW-5237
    
    Author: Joris Van den Bossche <jo...@gmail.com>
    
    Closes #4224 from jorisvandenbossche/pandas-metadata-version and squashes the following commits:
    
    184a9736d <Joris Van den Bossche> ARROW-5237:  populate _pandas_api.version
---
 python/pyarrow/pandas-shim.pxi      | 1 +
 python/pyarrow/tests/test_pandas.py | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/python/pyarrow/pandas-shim.pxi b/python/pyarrow/pandas-shim.pxi
index b0c5329..bb0fb94 100644
--- a/python/pyarrow/pandas-shim.pxi
+++ b/python/pyarrow/pandas-shim.pxi
@@ -58,6 +58,7 @@ cdef class _PandasAPIShim(object):
         self._array_like_types = (self._series, self._index,
                                   self._categorical_type)
 
+        self._version = pd.__version__
         from distutils.version import LooseVersion
         self._loose_version = LooseVersion(pd.__version__)
         if self._loose_version >= LooseVersion('0.20.0'):
diff --git a/python/pyarrow/tests/test_pandas.py b/python/pyarrow/tests/test_pandas.py
index 2c1ba30..9c0603e 100644
--- a/python/pyarrow/tests/test_pandas.py
+++ b/python/pyarrow/tests/test_pandas.py
@@ -505,6 +505,11 @@ class TestConvertMetadata(object):
             }
         ]
 
+    def test_metadata_pandas_version(self):
+        df = pd.DataFrame({'a': [1, 2, 3], 'b': [1, 2, 3]})
+        table = pa.Table.from_pandas(df)
+        assert table.schema.pandas_metadata['pandas_version'] is not None
+
 
 class TestConvertPrimitiveTypes(object):
     """