5
Şunun gibi bir veri çerçevem var;pandalar iki sütun gruplandırır ve diğer iki sütunu çoğaltır
price quantity vat
date brand
20-Jun-13 Reebok 7.0 8 2.2
Adidas 12.0 3 3.8
Campus 2.5 38 4.2
Woodlands 23.0 9 7.2
Boot 3.2 35 3.3
21-Jun-13 Reebok 7.0 6 2.2
Adidas 12.0 23 3.8
Campus 2.5 18 4.2
Woodlands 23.0 29 7.2
Boot 3.2 15 3.3
22-Jun-13 Reebok 5.0 2 3.5
Adidas 10.0 5 2.8
Campus 2.0 50 3.5
Woodlands 25.0 4 6.5
Boot 2.5 10 2.8
nasıl 'date'
GroupBy ve 'brand'
ve 'price'
çarpın ve 'quantity'
satışlarını hesaplamak mı?
Denedim;
baskı data2.groupby(['date','brand'])['price'] * ['quantity']
Ben tarihe göre toplam satışları hesaplamak istiyoruz.
'data2.groupby ([ 'tarih']) [ 'satış'] toplamı() Bu mantıklı geliyor Andy? – richie
Bu, günlük satışları alırken, groupby markası, markaya göre toplam satış alacaktır :) –