I have a time series of data in the following form:

| purchase_date    |    cutomer_id  |   product 
   2018-10-31            id1              prod1     
   2018-11-14            id1              prod1      
   2019-01-05            id1              prod2  
   2019-03-07            id1              prod30     
   2019-03-31            id2              prod31    
   2018-04-07            id2              prod2

I am trying to resample this data weekly to fill in missing weeks and fill NaN values using most frequent value efficiently. Everything I have tried is way too slow for dataset this big (almost billion rows). Any ideas on how to do this efficiently?

  • $\begingroup$ Sharing a snippet of the code that you have tried to use would be helpful. Have you tried using a groupby and apply combination? $\endgroup$ – bradS Oct 21 '19 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.