Background : The business objective is to build a ML model which predicts lift in profit based on historical performance of the product during both promotional period as well as non-promotional periods.
I have built a ML model which predicts profit on daily level for each asin based on historical data using following inputs : Date, Product ID, Promotion flag , Promotion type, discount percent, current price.
Now I want to generate inference data by building a dataset which has all combinations of productID and promotion types along with several levels of discount percent for each day in the future. Is there a way to do this in pandas ?
Conditions : Given a date range (for ex. 3/17/23 - 3/27/23), promotion types - 3 types of promotions (bd,pd,ld), discount percent [0,5,10]
generate data for each day in the date range for each productID with different combinations of promotion type and discount percent.
Expected dataframe output :
This is just an example for two dates (3/17 and 3/18), 1 productID and all combinations for promotion type and discount percent. I want to create this for entire range of dates for each productID.
Looking at the example of the expected output you provided, here is a simple way to do it: list the different values you want to see in your dataframe, generate all combinations using
itertools.product, and finally create the dataframe with the columns you want.Here are the 15th first rows: