Skip to content

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
apache:mainfrom
555aaditya:GH-55298-list-to-pandas-types
Open

555aaditya wants to merge 1 commit into
apache:mainfrom
555aaditya:GH-55298-list-to-pandas-types

Conversation

@555aaditya

@555aaditya 555aaditya commented Oct 28, 2026 •

Copy link
Copy Markdown

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, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

…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.
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #55298 has been automatically assigned in GitHub to PR creator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant