Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. this is input
  2. date category sales
  3. 0 20/2/2014 weekdays 120.96
  4. 1 05/03/2015 weekend 120.96
  5. 2 19/05/2014 weekdays 75.99
  6. 3 09/02/2014 weekend 60.76
  7. 4 15/03/2015 weekdays 49.01
  8. 5 03/03/2014 weekend 50.3
  9. 6 09/05/2014 weekend 203.2
  10.  
  11. df2 = df.groupby(['date','category'], as_index=False)['sales'].sum()
  12. print (df2)
  13.  
  14. date category sales
  15. 2014 weekdays 196.95
  16. 2014 weekend 314.26
  17. 2015 weekdays 49.01
  18. 2015 weekend 120.96
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement