I have the following dataframe:
df = pd.DataFrame({'recipe': ['a', 'a', 'a', 'a', 'a','a', 'b', 'b', 'b', 'b', 'b','b'],
'product': ['A', 'B', 'C', 'D', 'E', 'F', 'A', 'B', 'G', 'I', 'K', 'F']})
And I want to pivot the dataframe for the output to have one row for each recipe and multiple columns for each product, ex:
recipe p1 p2 p3 p4 p5 p6
a A B C D E F
b A B G I K F
Also, there are multiple products, but I want the top 6 based on another column that gives a ranking for how relevant the product is