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

[Python] DictionaryArray.to_numpy does not correctly convert null indexes to null values

    XMLWordPrintableJSON

Details

    Description

      Example

      >>> a = pa.DictionaryArray.from_arrays(pa.array([0, 1, None, 0], type=pa.int32()), pa.array(['foo', 'bar']))
      >>> a
      <pyarrow.lib.DictionaryArray object at 0x7f12fc94ccf0>-- dictionary:
        [
          "foo",
          "bar"
        ]
      -- indices:
        [
          0,
          1,
          null,
          0
        ]
      >>> a.to_pandas()  # this works
      0    foo
      1    bar
      2    NaN
      3    foo
      dtype: category
      Categories (2, object): [foo, bar]
      >>> a.to_numpy(zero_copy_only=False)  # this is broken
      array(['foo', 'bar', 'bar', 'foo'], dtype=object)
      
      

       

      Attachments

        Issue Links

          Activity

            People

              amol- Alessandro Molina
              chairmank Steve M. Kim
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 7h 10m
                  7h 10m