Repository navigation
GH-55298: [Python] Support lists of view, decimal32/64 and fixed_size_binary types in to_pandas - #55302
Open
555aaditya wants to merge 1 commit into
Open
GH-55298: [Python] Support lists of view, decimal32/64 and fixed_size_binary types in to_pandas#55302555aaditya wants to merge 1 commit into
555aaditya wants to merge 1 commit into
Conversation
…d_size_binary types in to_pandas ListTypeSupported did not list string_view, binary_view, decimal32, decimal64 or fixed_size_binary, so converting lists of these types to pandas raised NotImplementedError even though the object conversion of the values already supports them. Since uuid uses fixed_size_binary storage, lists of uuid now convert too. Keep the uuid extension values in that case so they come out as uuid.UUID objects, like a top-level uuid array, instead of raw bytes.
555aaditya
requested review from
AlenkaF,
pitrou,
raulcd and
rok
as code owners
October 28, 2026 18:15
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
Converting a list array to pandas raises
NotImplementedErrorwhen the values arestring_view,binary_view,decimal32,decimal64orfixed_size_binary, for examplepa.array([["a"]], pa.list_(pa.string_view())).to_pandas(). The equivalentstring,binaryanddecimal128lists convert fine.What changes are included in this PR?
ListTypeSupportedinarrow_to_pandas.cc. The object conversion used for the list values already handles them.uuidhasfixed_size_binary(16)storage, so lists ofuuidnow pass that check as well. List conversion normally replaces extension values with their storage, which would turn the UUIDs into raw bytes. Foruuidthe values are now kept as extension values, so they come out asuuid.UUIDobjects, the same as for a top-leveluuidarray.Are these changes tested?
Yes.
test_pandas.py::TestConvertListTypes::test_list_of_view_decimal_and_fixed_size_binarycovers the five value types underlist_,large_listandlist_view, through bothArray.to_pandas()andTable.to_pandas(). Without the fix all 5 cases fail with the error from the issue.test_extension_type.py::test_list_of_uuid_to_pandascoverslist<uuid>andlarge_list<uuid>.test_pandas.pyandtest_extension_type.pypass locally (macOS arm64, Python 3.13, debug build). The exception istest_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 ofuuid.UUIDobjects.Was AI used for this PR?
In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.
PR code and description written by:
Reviewed before submission by: