1
我有一個大熊貓dataframe如下。需要再添加兩列,分別列出特定品牌的銷售額最高和最低值。Excel等效於使用Python中的熊貓的數組
date brand price quantity sales vat
31-May-13 Reebok 10 23 230 3.5
31-May-13 Adidas 10 25 250 2.8
31-May-13 Campus 8 21 168 3.5
31-May-13 Nike 10 20 200 6.5
31-May-13 Woods 2 7 14 2.8
01-Jun-13 Reebok 4 27 108 2.2
01-Jun-13 Adidas 7 28 196 3.8
01-Jun-13 Campus 7 41 287 4.2
01-Jun-13 Nike 2 39 78 7.2
01-Jun-13 Woods 5 26 130 3.3
02-Jun-13 Reebok 10 5 50 2.2
02-Jun-13 Adidas 10 15 150 3.8
02-Jun-13 Woods 6 30 180 3.3
這裏我的日期欄不是按順序排列的,並且所有品牌數據都不能用於日期列中的evey日期。其結果應該是什麼樣子,
date brand price quantity sales vat Max Min
31-May-13 Reebok 10 23 230 3.5 230 50
31-May-13 Adidas 10 25 250 2.8 250 150
31-May-13 Campus 8 21 168 3.5 287 168
31-May-13 Nike 10 20 200 6.5 200 78
31-May-13 Woods 2 7 14 2.8 180 14
01-Jun-13 Reebok 4 27 108 2.2 230 50
01-Jun-13 Adidas 7 28 196 3.8 250 150
01-Jun-13 Campus 7 41 287 4.2 287 168
01-Jun-13 Nike 2 39 78 7.2 200 78
01-Jun-13 Woods 5 26 130 3.3 180 14
02-Jun-13 Reebok 10 5 50 2.2 230 50
02-Jun-13 Adidas 10 15 150 3.8 250 150
02-Jun-13 Woods 6 30 180 3.3 180 14