0

I've a pandas data frame, df with structure similar to

Timestamp, colA, colB, colC, colD

Now, I want a multi-indexed data frame

colA, colB, colC, colD, Time window, count

where colA, colB, colC, colD forms a multi-index index and time-window denotes a 5 minute time stamp window and count denotes the number of times the event identified by multi-index occurs in this rolling five minute window occurred. This operation is required to be performed every 30 minutes, t-35 mins to t-5, so there are 30 possible 5 min windows.

dbot_5
  • 13
  • 2
  • What have you tried so far ? – Alexandre B. Apr 15 '20 at 16:28
  • I've tried getting unique timestamps by doing a groupby size and and than sliding the window to get a count. This very moment I'm exploring the rolling function, which I think will serve the purpose. – dbot_5 Apr 15 '20 at 16:50
  • Can you add a sample of your input data and the expected output ? See [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – Alexandre B. Apr 15 '20 at 16:53

0 Answers0