Conversation
uproot.concatenate and uproot.iterate re-index each file's Pandas output so that entry numbers are global rather than per-file, but Pandas.global_index only recursed through tuples and lists. With library="pd" and how=dict both raised AttributeError: 'dict' object has no attribute 'index', even for a single file. RNTuple.arrays subtracts the first read cluster's offset from entry_start to index into the concatenated cluster buffers, then reused that cluster-relative value to build the Pandas RangeIndex. Reading entries [4:6] of an RNTuple whose clusters break at entry 4 returned the right values indexed [0, 1] instead of [4, 5], which is what the equivalent TTree returns. Assisted-by: claude-code:claude-opus-5[1m]
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
|
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.
🤖 AI text below 🤖
Addresses the two Pandas findings from #1688 (grouped as "PR 6" there).
how=dictfails in the multi-file APIsPandas.global_indexre-indexes each file's output so that entry numbers are global rather than restarting at 0 per file. It recursed throughtupleandlist, but notdict, so both of these raisedAttributeError: 'dict' object has no attribute 'index'— even with a single file:TTree.arrays(how=dict)andTTree.iterate(how=dict)were unaffected, because they never callglobal_index.RNTuple Pandas indices were cluster-relative
RNTuple.arrayssubtracts the first read cluster's offset fromentry_startso it can slice into the concatenated cluster buffers, then reused that cluster-relative value to build theRangeIndex. Reading entries[4:6]of an RNTuple whose clusters break at entry 4 returned the right values indexed[0, 1]; the equivalent TTree returns[4, 5].Kept as
global_entry_startbefore the subtraction and used for the index only.Tests
tests/test_1688_pandas_global_index.py:how=dictfor one and two files through bothconcatenateanditerate,how=tuple/how=listas controls, and RNTuple entry ranges inside, spanning, and beyond the first cluster, plus a direct comparison against the TTree index. 7 of the 12 fail onmain.Full suite passes locally (1028 passed, 90 skipped).