Nov-06-2019, 07:41 PM
i have a scenario in which i have a dataframe which contains 3 columns ( date, product_id and sales_amt)
the dates are supposed to span a whole month ( eg nov 2019) but there are some missing days in the dataframe for each product_id.
does anyone have any tips on python code that can loop through the dates for a particular month AND product and add a new row to the dataframe with the missing date, product_id and a sales_amt of zero?
Goal at the end is to have an entry for every day of that month per product_id. i believe resample can handle this but what would the code look like?
thanks for any guidance on this.
Thanks
the dates are supposed to span a whole month ( eg nov 2019) but there are some missing days in the dataframe for each product_id.
does anyone have any tips on python code that can loop through the dates for a particular month AND product and add a new row to the dataframe with the missing date, product_id and a sales_amt of zero?
Goal at the end is to have an entry for every day of that month per product_id. i believe resample can handle this but what would the code look like?
thanks for any guidance on this.
Thanks