Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this is input
- date category sales
- 0 20/2/2014 weekdays 120.96
- 1 05/03/2015 weekend 120.96
- 2 19/05/2014 weekdays 75.99
- 3 09/02/2014 weekend 60.76
- 4 15/03/2015 weekdays 49.01
- 5 03/03/2014 weekend 50.3
- 6 09/05/2014 weekend 203.2
- df2 = df.groupby(['date','category'], as_index=False)['sales'].sum()
- print (df2)
- date category sales
- 2014 weekdays 196.95
- 2014 weekend 314.26
- 2015 weekdays 49.01
- 2015 weekend 120.96
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement