0

Find out the sale amount for each id Day 1 to Day 4 i.e. Total sale amount in the first 4 days Day 5 to Day 10 i.e. Total sale amount in the next 5 days and so on Day 11 to Day 18 Day 19 to Day 28 Beyond Day 28 till date

What should I do next, how to select sum first 3 sale amounts together?

df.groupby(['ID','date']).sum()
output
ID                DATE
8259951          01/01/22   2000.0
                 02/01/22   1000.0
                 08/01/22   7000.0
                 09/01/22   4150.0
                 14/01/22   6000.0
... ... ...
148173081   31/01/22    150.0
148174131   31/01/22    100.0
148174601   31/01/22    1950.0
148174631   31/01/22    300.0
148175761   31/01/22    100.0
Nick ODell
  • 15,465
  • 3
  • 32
  • 66
Nh11
  • 1
  • Related:[How to group DataFrame by a period of time?](https://stackoverflow.com/questions/11073609/how-to-group-dataframe-by-a-period-of-time). [Pandas groupby to compute rolling sum over the next n-days](https://stackoverflow.com/questions/66586889/pandas-groupby-to-compute-rolling-sum-over-the-next-n-days) – wwii Oct 29 '22 at 18:56
  • First 3 sales per ID? – bitflip Oct 29 '22 at 21:30

0 Answers0