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/02/22 15:45:50 UTC
[arrow] branch master updated: ARROW-1345: [Python] Test conversion
from nested NumPy arrays with smaller int, float types
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 897cc4d ARROW-1345: [Python] Test conversion from nested NumPy arrays with smaller int, float types
897cc4d is described below
commit 897cc4d917e375b180147856baa9c5da2e6173e5
Author: Wes McKinney <we...@twosigma.com>
AuthorDate: Thu Feb 22 10:45:45 2018 -0500
ARROW-1345: [Python] Test conversion from nested NumPy arrays with smaller int, float types
This also resolves ARROW-2008
Author: Wes McKinney <we...@twosigma.com>
Closes #1643 from wesm/ARROW-1345 and squashes the following commits:
a0997104 [Wes McKinney] Add another test
8af33486 [Wes McKinney] Add unit test for ARROW-1345
---
python/pyarrow/tests/test_convert_pandas.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/python/pyarrow/tests/test_convert_pandas.py b/python/pyarrow/tests/test_convert_pandas.py
index 6b62622..6e68dd9 100644
--- a/python/pyarrow/tests/test_convert_pandas.py
+++ b/python/pyarrow/tests/test_convert_pandas.py
@@ -1269,6 +1269,21 @@ class TestListTypes(object):
assert arr.equals(expected)
assert arr.type == pa.list_(pa.null())
+ def test_nested_smaller_ints(self):
+ # ARROW-1345, ARROW-2008, there were some type inference bugs happening
+ # before
+ data = pd.Series([np.array([1, 2, 3], dtype='i1'), None])
+ result = pa.array(data)
+ result2 = pa.array(data.values)
+ expected = pa.array([[1, 2, 3], None], type=pa.list_(pa.int8()))
+ assert result.equals(expected)
+ assert result2.equals(expected)
+
+ data3 = pd.Series([np.array([1, 2, 3], dtype='f4'), None])
+ result3 = pa.array(data3)
+ expected3 = pa.array([[1, 2, 3], None], type=pa.list_(pa.float32()))
+ assert result3.equals(expected3)
+
def test_infer_lists(self):
data = OrderedDict([
('nan_ints', [[None, 1], [2, 3]]),
--
To stop receiving notification emails like this one, please contact
wesm@apache.org.