df = pd.DataFrame([{'Instrument':'AAA', 'Date':'2012-04-18', 'Time_Bucket':180},
{'Instrument':'AAA', 'Date':'2012-04-18', 'Time_Bucket':100},
{'Instrument':'AAA', 'Date':'2012-04-18', 'Time_Bucket':67},
{'Instrument':'AAA', 'Date':'2012-04-18', 'Time_Bucket':33},
{'Instrument':'AAA', 'Date':'2012-04-18', 'Time_Bucket':1},
{'Instrument':'AAA', 'Date':'2012-04-19', 'Time_Bucket':175},
{'Instrument':'AAA', 'Date':'2012-04-19', 'Time_Bucket':110},
{'Instrument':'AAA', 'Date':'2012-04-19', 'Time_Bucket':30},
{'Instrument':'AAA', 'Date':'2012-04-19', 'Time_Bucket':1},
{'Instrument':'BBB', 'Date':'2012-04-18', 'Time_Bucket':180},
{'Instrument':'BBB', 'Date':'2012-04-18', 'Time_Bucket':150},
{'Instrument':'BBB', 'Date':'2012-04-18', 'Time_Bucket':10}])
I have the above DataFrame. My aim is to create a large dataframe that contains all the Instruments for different Dates with a Time_Bucket ranging from 180 to 1. Meaning, if I have 100 Instruments for Dates 2012-04-18, 2012-04-19, 2012-05-17, 2012-05-18, 2012-08-15, 2012-08-16, then I will need to create a total number of rows of 100*6*180, with each cell being labelled in an ascending order for Date, but descending order for Time_Bucket. Then I will merge my existing DataFrame with this newly created Dataframe and fill forward for some data analysis. I'm only able to code the following but it doesn't work:
df = pd.DataFrame({ 'Instrument' : 'AAA', 'BBB', 'CCC'},
{'Date': '2012-04-18', '2012-04-19', '2012-05-17', '2012-05-18', '2012-08-15', '2012-08-16'},
{'Time_Bucket': range(180, N-1 ,1))
Could you please help? Thank you.