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 2018/08/18 14:08:51 UTC

[arrow] branch master updated: ARROW-3053: [Python] Add unit test for strided object conversion that was failing in 0.9.0

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 da73971  ARROW-3053: [Python] Add unit test for strided object conversion that was failing in 0.9.0
da73971 is described below

commit da739714a8bd664ddd14fd5699366df8f752cde5
Author: Krisztián Szűcs <sz...@gmail.com>
AuthorDate: Sat Aug 18 10:08:42 2018 -0400

    ARROW-3053: [Python] Add unit test for strided object conversion that was failing in 0.9.0
    
    Author: Krisztián Szűcs <sz...@gmail.com>
    Author: Wes McKinney <we...@apache.org>
    
    Closes #2429 from kszucs/ARROW-3053 and squashes the following commits:
    
    9f3f4739 <Wes McKinney> Do not install hdf5, remove iterator protocol from NdarrayIndexer
    5c31f496 <Krisztián Szűcs> hdf5 decimal roundtrip
---
 ci/travis_script_python.sh                  |  1 +
 cpp/src/arrow/python/numpy-internal.h       |  3 ---
 python/pyarrow/tests/test_convert_pandas.py | 11 +++++++++++
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/ci/travis_script_python.sh b/ci/travis_script_python.sh
index 565df9d..89dbfed 100755
--- a/ci/travis_script_python.sh
+++ b/ci/travis_script_python.sh
@@ -112,6 +112,7 @@ pushd $ARROW_PYTHON_DIR
 
 # Other stuff pip install
 pip install -q -r requirements.txt
+
 if [ "$PYTHON_VERSION" == "3.6" ]; then
     pip install -q pickle5
 fi
diff --git a/cpp/src/arrow/python/numpy-internal.h b/cpp/src/arrow/python/numpy-internal.h
index 99ddbff..b214a50 100644
--- a/cpp/src/arrow/python/numpy-internal.h
+++ b/cpp/src/arrow/python/numpy-internal.h
@@ -56,9 +56,6 @@ class Ndarray1DIndexer {
 
   T* data() const { return data_; }
 
-  T* begin() const { return data(); }
-  T* end() const { return begin() + size() * stride_; }
-
   bool is_strided() const { return stride_ != 1; }
 
   T& operator[](size_type index) { return data_[index * stride_]; }
diff --git a/python/pyarrow/tests/test_convert_pandas.py b/python/pyarrow/tests/test_convert_pandas.py
index 03877a0..1cb58ff 100644
--- a/python/pyarrow/tests/test_convert_pandas.py
+++ b/python/pyarrow/tests/test_convert_pandas.py
@@ -1403,6 +1403,17 @@ class TestConvertDecimalTypes(object):
         series = pd.Series([decimal.Decimal('3.14'), None])
         _check_series_roundtrip(series, expected_pa_type=pa.decimal128(3, 2))
 
+    def test_strided_objects(self, tmpdir):
+        # see ARROW-3053
+        data = {
+            'a': {0: 'a'},
+            'b': {0: decimal.Decimal('0.0')}
+        }
+
+        # This yields strided objects
+        df = pd.DataFrame.from_dict(data)
+        _check_pandas_roundtrip(df)
+
 
 class TestListTypes(object):
     """