-1
df=pandas.DataFrame(processed_data_format, columns=["file_name", "innings", "over","ball", "individual ball", "runs","batsman", "wicket_status","bowler_name","fielder_name"])
df.groupby(['batsman'])['runs','ball'].sum()
一個GROUPBY利用這一點,我會得到這樣的如何使用SUM()和COUNT()(兩者)在大熊貓
a 30 29
b 4 1
c 10 15
的結果,我想獲得的計數如所提到的名爲filename與代碼的結果列above.The最終結果應該是像
a 30 29 2
b 4 1 1
c 10 15 2
您可以添加樣本'processed_data_format' – jezrael
http://stackoverflow.com/questions/29127376/pandas-using-multiple - 功能在一個組中可能的重複,更不用說這裏完全覆蓋http://pandas.pydata.org/pandas-docs/stable/groupby.html#applying-multiple-functions-at-once – Chris
@ jezrael processed_data_format是列表的列表,沒有任何默認列,這就是爲什麼我給每個列的名稱。processed_data_format看起來像[[102032,1,1,1,3,4,Sachin,Caught,Akthar,Malik ],[102032,1,1,1,0.3,4,Sachin,Caught,Akthar,Malik] .....................] –