You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by uw...@apache.org on 2017/09/12 07:12:55 UTC
arrow git commit: ARROW-1459: [Python] Use list values length to
advance offset when reconstructing array of ndarrays
Repository: arrow
Updated Branches:
refs/heads/master 4c008c2b9 -> 6a020a1f8
ARROW-1459: [Python] Use list values length to advance offset when reconstructing array of ndarrays
Author: Wes McKinney <we...@twosigma.com>
Closes #1090 from wesm/ARROW-1459 and squashes the following commits:
39dd025 [Wes McKinney] Use list values length to advance offset when reconstructing array of ndarrays
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/6a020a1f
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/6a020a1f
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/6a020a1f
Branch: refs/heads/master
Commit: 6a020a1f8297c7b6100538d395fa8853adef8f18
Parents: 4c008c2
Author: Wes McKinney <we...@twosigma.com>
Authored: Tue Sep 12 09:12:51 2017 +0200
Committer: Uwe L. Korn <uw...@xhochy.com>
Committed: Tue Sep 12 09:12:51 2017 +0200
----------------------------------------------------------------------
cpp/src/arrow/python/arrow_to_pandas.cc | 2 +-
python/pyarrow/tests/test_convert_pandas.py | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/6a020a1f/cpp/src/arrow/python/arrow_to_pandas.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/python/arrow_to_pandas.cc b/cpp/src/arrow/python/arrow_to_pandas.cc
index 148963f..be738e7 100644
--- a/cpp/src/arrow/python/arrow_to_pandas.cc
+++ b/cpp/src/arrow/python/arrow_to_pandas.cc
@@ -519,7 +519,7 @@ inline Status ConvertListsLike(PandasOptions options, const std::shared_ptr<Colu
++out_values;
}
- chunk_offset += arr->length();
+ chunk_offset += arr->values()->length();
}
Py_XDECREF(numpy_array);
http://git-wip-us.apache.org/repos/asf/arrow/blob/6a020a1f/python/pyarrow/tests/test_convert_pandas.py
----------------------------------------------------------------------
diff --git a/python/pyarrow/tests/test_convert_pandas.py b/python/pyarrow/tests/test_convert_pandas.py
index e98e83d..5d56cde 100644
--- a/python/pyarrow/tests/test_convert_pandas.py
+++ b/python/pyarrow/tests/test_convert_pandas.py
@@ -562,6 +562,24 @@ class TestPandasConversion(unittest.TestCase):
tm.assert_frame_equal(result, df)
+ def test_column_of_lists_chunked2(self):
+ data1 = [[0, 1], [2, 3], [4, 5], [6, 7], [10, 11],
+ [12, 13], [14, 15], [16, 17]]
+ data2 = [[8, 9], [18, 19]]
+
+ a1 = pa.array(data1)
+ a2 = pa.array(data2)
+
+ t1 = pa.Table.from_arrays([a1], names=['a'])
+ t2 = pa.Table.from_arrays([a2], names=['a'])
+
+ concatenated = pa.concat_tables([t1, t2])
+
+ result = concatenated.to_pandas()
+ expected = pd.DataFrame({'a': data1 + data2})
+
+ tm.assert_frame_equal(result, expected)
+
def test_column_of_lists_strided(self):
df, schema = dataframe_with_lists()
df = pd.concat([df] * 6, ignore_index=True)