我使用這個數據幀:熊貓集團,通過與和
Fruit Date Name Number
Apples 10/6/2016 Bob 7
Apples 10/6/2016 Bob 8
Apples 10/6/2016 Mike 9
Apples 10/7/2016 Steve 10
Apples 10/7/2016 Bob 1
Oranges 10/7/2016 Bob 2
Oranges 10/6/2016 Tom 15
Oranges 10/6/2016 Mike 57
Oranges 10/6/2016 Bob 65
Oranges 10/7/2016 Tony 1
Grapes 10/7/2016 Bob 1
Grapes 10/7/2016 Tom 87
Grapes 10/7/2016 Bob 22
Grapes 10/7/2016 Bob 12
Grapes 10/7/2016 Tony 15
我想通過名字來此聚集,然後用水果,讓每名水果的總數。
Bob,Apples,16 (for example)
我試着按名稱和水果分組,但是如何獲得水果總數。
鑑於'groupby'參數列表中的順序,數據不會先被分組到名稱中,然後按每個賣家的水果分組嗎? –
@p_sutherland你是對的,更正了。 –
大熊貓如何知道我想對名爲'Number'的col進行求和? – Kingname