Skip to content

fix: PyArrow instead of deprecated awkward-pandas - #1718

Open
2xB wants to merge 2 commits into
scikit-hep:mainfrom
2xB:main
Open

2xB wants to merge 2 commits into
scikit-hep:mainfrom
2xB:main

Conversation

@2xB

@2xB 2xB commented Sep 10, 2026

Copy link
Copy Markdown

awkward-pandas is deprecated. This PR solves that by using PyArrow instead as described in https://awkward-array.org/doc/main/user-guide/how-to-convert-pandas.html . This does change the output data type slightly, see tests affected by this commit.

Some arrays in the test are no longer plain nested Python arrays but Python arrays of NumPy arrays, using awkward.array_equal to compare them across types.

I tried to reflect the changed behavior in the documentation. This does change the dependency on awkward-pandas to a dependency on PyArrow, which I however believe to be justified since the above linked Pandas guide itself suggests doing so.

Fixes #1706

[edit] Side note: I thought about whether to try and replicate the old behavior of awkward-pandas, but I believe it should be better to use the documented approaches. It is worth noting that having NumPy arrays instead of plain Python arrays or no longer having the .ak accessor but instead a different code to get Awkward arrays does affect the usage of this library, so this commit could also be tagged BREAKING CHANGE:. Btw. Pandas nowadays also has a native ArrowDtype https://pandas.pydata.org/docs/reference/api/pandas.ArrowDtype.html, but that is still written as experimental. But going from the Awkward dtype of awkward-pandas to the ArrowDtype provided by Pandas would rely on experimental features and I do not know if one would gain much.

awkward-pandas is deprecated. Using PyArrow instead as described in https://awkward-array.org/doc/main/user-guide/how-to-convert-pandas.html . This does change the output data type slightly, see tests affected by this commit.
@github-actions github-actions Bot added the type/fix PR title type: fix (set automatically) label Sep 10, 2026
@2xB 2xB closed this Sep 10, 2026
@2xB 2xB reopened this Sep 10, 2026
@2xB

2xB commented Sep 10, 2026

Copy link
Copy Markdown
Author

Note: The predecessor of awkward-pandas is akimbo (https://github.com/intake/awkward-pandas even forwards to https://github.com/intake/akimbo). That is a library with the feature that as soon as you write import akimbo.pandas, all Pandas arrays automatically can be accessed with .ak like those gotten by awkward-pandas before. One could document that as well or discuss if akimbo.pandas should be imported automatically so uproots Pandas arrays automatically behave more like they did before. I would guess the second option might be more natural, but it also adds another dependency.

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

Labels

type/fix PR title type: fix (set automatically)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

awkward_pandas is outdated and AwkwardExtensionArray breaks HDF5 export

1 participant