-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Description
Hi developers !
I am creating a pandas dataframe but issue is its giving me tuple each time.
AttributeError Traceback (most recent call last)
/tmp/ipykernel_557/1180174254.py in
2 import pandas as pd
3
----> 4 dfall.columns
AttributeError: 'tuple' object has no attribute 'columns'
Here is the code that I run for making pandas dataframe.
filename = "/eos/cms/store/group/phys_higgs/cmshww/amassiro/HWWNano/Summer20UL18_106x_nAODv9_Full2018v9/MCl1loose2018v9__MCCorr2018v9NoJERInHorn__MCCombJJLNu2018/nanoLatino_GluGluToWWToQQ_Sig_private__part9.root"
file = uproot.open(filename)
# show what is inside the root file loaded from uproot
print(file.classnames())
print(file.keys())
tree = file["Events"] # select the TTree inside the root file
tree.show() # show all the branches inside the TTree
dfall = tree.arrays(library="pd") # convert uproot TTree into pandas dataframe
#dfall.columns
print("type of dfall", type(dfall))
print("============================================")
print("File loaded with ", len(dfall), " events ")
Thanks,
Sadhana
Metadata
Metadata
Assignees
Labels
No labels