Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-9817

[Python] pa.array raises for mixed scalar types (float16 + int)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.0.0
    • None
    • Python

    Description

      pa.array raises with mixed scalars for np.float16 and a numpy int: 

      In [1]: import numpy as np 
       ...: import pyarrow as pa 
       ...: pa.array([np.float16(1.5), np.int64(5)]) 
      ---------------------------------------------------------------------------
      ArrowInvalid Traceback (most recent call last)
      <ipython-input-2-b1e9d890f325> in <module>
       1 import numpy as np
       2 import pyarrow as pa
      ----> 3 pa.array([np.float16(1.5), np.int64(5)])
      ~/git_repo/arrow/python/pyarrow/array.pxi in pyarrow.lib.array()
       269 else:
       270 # ConvertPySequence does strict conversion if type is explicitly passed
      --> 271 return _sequence_to_array(obj, mask, size, type, pool, c_from_pandas)
       272 
       273
      ~/git_repo/arrow/python/pyarrow/array.pxi in pyarrow.lib._sequence_to_array()
       38 
       39 with nogil:
      ---> 40 check_status(ConvertPySequence(sequence, mask, options, &out))
       41 
       42 if out.get().num_chunks() == 1:
      ~/git_repo/arrow/python/pyarrow/error.pxi in pyarrow.lib.check_status()
       82 
       83 if status.IsInvalid():
      ---> 84 raise ArrowInvalid(message)
       85 elif status.IsIOError():
       86 # Note: OSError constructor is
      ArrowInvalid: Cannot mix NumPy dtypes float16 and int64 
      

      On master I get the same behaviour with all numpy ints (signed and unsigned)

      Attachments

        Activity

          People

            Unassigned Unassigned
            arw2019 Andrew Wieteska
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: