555aaditya opened a new pull request, #55302:
URL: https://github.com/apache/arrow/pull/55302

   ### Rationale for this change
   
   Converting a list array to pandas raises `NotImplementedError` when the 
values are `string_view`, `binary_view`, `decimal32`, `decimal64` or 
`fixed_size_binary`, for example `pa.array([["a"]], 
pa.list_(pa.string_view())).to_pandas()`. The equivalent `string`, `binary` and 
`decimal128` lists convert fine.
   
   ### What changes are included in this PR?
   
   - Add the five types to `ListTypeSupported` in `arrow_to_pandas.cc`. The 
object conversion used for the list values already handles them.
   - `uuid` has `fixed_size_binary(16)` storage, so lists of `uuid` now pass 
that check as well. List conversion normally replaces extension values with 
their storage, which would turn the UUIDs into raw bytes. For `uuid` the values 
are now kept as extension values, so they come out as `uuid.UUID` objects, the 
same as for a top-level `uuid` array.
   
   ### Are these changes tested?
   
   Yes.
   
   - 
`test_pandas.py::TestConvertListTypes::test_list_of_view_decimal_and_fixed_size_binary`
 covers the five value types under `list_`, `large_list` and `list_view`, 
through both `Array.to_pandas()` and `Table.to_pandas()`. Without the fix all 5 
cases fail with the error from the issue.
   - `test_extension_type.py::test_list_of_uuid_to_pandas` covers `list<uuid>` 
and `large_list<uuid>`.
   - `test_pandas.py` and `test_extension_type.py` pass locally (macOS arm64, 
Python 3.13, debug build). The exception is `test_cpp_extension_in_python`, 
which I couldn't run: it fails at the link step locally because my dev build's 
libarrow isn't next to pyarrow. It doesn't touch this code.
   
   ### Are there any user-facing changes?
   
   Yes. Lists of these types now convert to pandas instead of raising. 
`list<uuid>` converts to lists of `uuid.UUID` objects.
   
   ### Was AI used for this PR?
   
   In accordance to the [AI generation 
guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code),
 please disclose below whether and how AI was used in this PR.
   
   **PR code and description written by:**
   
   - [x] Human
   - [x] AI
   
   **Reviewed before submission by:**
   
   - [x] Human
   - [ ] AI
   - [ ] Not reviewed
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to