I used to retrieve pandas dataframe from ROOT file using tree.pandas.df() function in Uproot4(2 years ago). However, I got the below errors when I ran my code recently. Could anyone tell me what the problem is?
f = uproot.open(inputFile)
treeName = "myTreeName"
tree = f[treeName]
myDf = tree.pandas.df('branchName',entrystop=nEvent, flatten = False)
AttributeError: 'Model_TTree_v19' object has no attribute 'pandas'
In Uproot version 3, a special function named
TTree.pandas.dfcreated Pandas DataFrames.In Uproot version 4 (and above), all of the functions that produce arrays have a
libraryargument that specifies which library to use to represent the arrays.library="pd"makes Pandas DataFrames.This change is described in the Uproot 3 → 4 cheat-sheet, the new argument is described in several places in the Getting Started Guide, as well as in all the reference documentation for array-fetching functions, such as TTree.arrays.