#Top 3 판매 제품
top_selling=retail.groupby('StockCode').sum()['Quantity'].sort_values(ascending=False)[:3]
top_selling
#top3 아이템에 대한 월별 판매량 추이
monthly_top3=retail.set_index('InvoiceDate').groupby(['StockCode',extract_month]).sum()[['Quantity','CheckoutPrice']].loc[top_selling.index]
monthly_top3
'Python' 카테고리의 다른 글
파이썬_특정값이 포함된 칼럼을 찾아 row 제거하기 (drop if) (0) | 2020.09.25 |
---|---|
파이썬_파일 불러올 때 첫 행 제거하기 read_excel,read_csv (0) | 2020.09.25 |
파이썬_X축 눈금값 바꾸기(data visualisation) (0) | 2020.09.21 |
파이썬_lambda 함수로 요일, 시간 불러오기 (0) | 2020.09.21 |
파이썬_날짜별(date time) 데이터 분석 시 유의사항 (0) | 2020.09.21 |