`'Model_ROOT_3a3a_Experimental_3a3a_RNTuple' object is not subscriptable` error while accessing event keys
Uproot version: 5.3.10
We compared data loading for TTree and RNTuple structures.
We tried to use method:
# Loading the file:
with uproot.open(file) as f: # Remote TTree
events = f["Events"]
# Getting array:
array = events["Electron_pt"].array()
Accessing "Electron_pt" key worked with TTree, but did not work with RNTuple. In RNTuple case we got this error:
'Model_ROOT_3a3a_Experimental_3a3a_RNTuple' object is not subscriptable
For now as a workaround we used this approach:
events.arrays()["Electron_pt"],
(NOTE: this approach is really slow when used with TTree).
If possible, we would like to :
- use the same
array = events["Electron_pt"].array()syntax for RNTuple as with TTree and get the same results.
Tags: @davidlange6, @ariostas
Does events.arrays(["Electron_pt"])["Electron_pt"] work? I imagine events.arrays()["Electron_pt"] is slow because it will read the full file.
Does
events.arrays(["Electron_pt"])["Electron_pt"]work? I imagineevents.arrays()["Electron_pt"]is slow because it will read the full file.
I checked it. Yes it works and is way faster. Thanks, I will use this approach for loading from now.
Fixed in #1250