i have a small python problem i’m trying to solve;
so i have a dataframe in this format;
date, product, store, sales_amt
1/1/2019, A, A, 200
1/1/2019,A,B,120
1/2/2019, A, A, 75
1/3/2019,A,A,69
1/3/2019,A,B,23
----
----
----
1/31/2019,A,B,49
i have a scenario in which i have a dataframe which contains 4 columns ( date, product, store and sales_amt)
the dates are supposed to span a whole month ( eg in this case, january 2019) but there are some missing days in the dataframe.
does anyone have any tips on python code that can loop through the dates for a particular month and add a new row to the dataframe with the missing date, product/store combination and a sales_amt of zero?
For example, there is no entry for the product/store combination of A/B on 1/2/2019
Goal at the end is to have an entry for every day of that month for every product/store combination.
how best can i do this? Looks like something for resample but not really sure.
Any ideas on how to go about this would be really appreciated.
thanks