I have dataframe below where i trying to get all products that out in the same order in one single line.
I using the code and dataframe below.
df3 = df1.groupby(df1.index)['PartNo'].agg([('product','first'), ('productNew','last')])
        Product 
88      prod1
88      prod2
88      prod3
89      prod3
89      prod4
However, the max that I can get is 2 products based in 'first' and 'last' agg.
My output is.
        product  productNew     
88      prod1  prod2
89      prod3  prod4
How i can change my code to get N products in the same line for each order as sample below?
        0       1       2.....N 
88      prod1  prod2 prod3
89      prod3  prod4 NaN
 
    