[ 
https://issues.apache.org/jira/browse/ARROW-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16372971#comment-16372971
 ] 

ASF GitHub Bot commented on ARROW-1345:
---------------------------------------

wesm closed pull request #1643: ARROW-1345: [Python] Test conversion from 
nested NumPy arrays with smaller int, float types
URL: https://github.com/apache/arrow/pull/1643
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/python/pyarrow/tests/test_convert_pandas.py 
b/python/pyarrow/tests/test_convert_pandas.py
index 6b62622f5..6e68dd961 100644
--- a/python/pyarrow/tests/test_convert_pandas.py
+++ b/python/pyarrow/tests/test_convert_pandas.py
@@ -1269,6 +1269,21 @@ def test_nested_lists_all_empty(self):
         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]]),


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [Python] Conversion from nested NumPy arrays fails on integers other than 
> int64, float32
> ----------------------------------------------------------------------------------------
>
>                 Key: ARROW-1345
>                 URL: https://issues.apache.org/jira/browse/ARROW-1345
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.8.0
>            Reporter: Wes McKinney
>            Assignee: Wes McKinney
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.9.0
>
>
> The inferred types are the largest ones, and then later conversion fails on 
> any arrays with smaller types because only exact conversions are implemented 
> thus far



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to