Instead of using get_dummies(), the ask over here is to have count . Eg: Consider T Shirt Sold at during each hour window.
df = pd.DataFrame({'Time': [0,0,0,1,1,1,2,2,3,3,3,4,4,4],
'Sale': ['M','M','S','S','M','XL','S','M','M','S','S','M','XL','XL'],
})
Output
Time, S,M,XL
0, 1,2,0
1, 1,1,1