Skip to content

Reading data into Pandas in Uproot 5; awkward-pandas versus MultiIndex #803

Answered by jpivarski
ast0815 asked this question in Q&A
Discussion options

You must be logged in to vote

You're right: this is a new feature and the docs are out of date. Thanks for the heads-up!

What's happening now is that any non-flat data uses the Awkward dtype provided by awkward-pandas.

If you want to explode the data as before, you can get it as an Awkward Array and use ak.to_dataframe:

>>> import uproot
>>> import awkward as ak
>>> ak.to_dataframe(events.arrays(filter_name="/(Jet|Muon)_P[xyz]/", library="ak"))
                   Jet_Px     Jet_Py      Jet_Pz    Muon_Px    Muon_Py     Muon_Pz
entry subentry                                                                    
1     0        -38.874714  19.863453   -0.894942  -0.816459 -24.404259   20.199968
3     0        -71.695213  93…

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
1 reply
@ast0815
Comment options

Answer selected by ast0815
Comment options

You must be logged in to vote
1 reply
@jpivarski
Comment options

Comment options

You must be logged in to vote
7 replies
@agoose77
Comment options

@ast0815
Comment options

@agoose77
Comment options

@douglasdavis
Comment options

@jpivarski
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
docs Improvements or additions to documentation
4 participants
Converted from issue

This discussion was converted from issue #800 on December 14, 2022 19:50.