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

[Python] Can't create array from Categorical with numpy 1.20

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0.0
    • 3.0.0
    • Python
    • None
    • OSX, numpy 1.20.0, pyarrow 2.0. pandas 1.2.1

    Description

      Upgraded to numpy 1.20, and some of my pipelines started to fail.

      With numpy 1.20

       

      In [16]: pa.lib.array(pd.Categorical(['a', 'b', 'c']))
      ---------------------------------------------------------------------------
      ArrowTypeError                            Traceback (most recent call last)
      <ipython-input-16-f1ab121f9533> in <module>
      ----> 1 pa.lib.array(pd.Categorical(['a', 'b', 'c']))~/.miniconda3/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib.array()~/.miniconda3/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib._codes_to_indices()~/.miniconda3/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib.array()~/.miniconda3/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib._ndarray_to_array()~/.miniconda3/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib._ndarray_to_type()~/.miniconda3/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.check_status()ArrowTypeError: Did not pass numpy.dtype object
      
      

      With 1.19.1

      In [13]: pa.lib.array(pd.Categorical(['a', 'b', 'c']))
      Out[13]:
      <pyarrow.lib.DictionaryArray object at 0x7febac27ad50>-- dictionary:
        [
          "a",
          "b",
          "c"
        ]
      -- indices:
        [
          0,
          1,
          2
        ]
      

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jseabold Skipper Seabold
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Slack

                  Issue deployment