[英]Does uproot4 not support tree.pandas.df()function anymore?
I used to retrieve pandas dataframe from ROOT file using tree.pandas.df() function in Uproot4(2 years ago). 但是,最近運行代碼時出現以下錯誤。 誰能告訴我問題是什么?
f = uproot.open(inputFile)
treeName = "myTreeName"
tree = f[treeName]
myDf = tree.pandas.df('branchName',entrystop=nEvent, flatten = False)
AttributeError: 'Model_TTree_v19' object 沒有屬性 'pandas'
在 Uproot 版本 3 中,名為TTree.pandas.df
的特殊 function 創建了 Pandas 數據幀。
在 Uproot 版本 4(及更高版本)中,生成 arrays 的所有函數都有一個library
參數,該參數指定使用哪個庫來表示 arrays。 library="pd"
生成 Pandas 數據幀。
Uproot 3 → 4 cheat-sheet中描述了此更改,入門指南中的多個位置以及數組獲取函數的所有參考文檔中都描述了新參數,例如TTree.arrays 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.