Hi I have a input file similar to this
Order_id ASIN
1 abc1
1 abc3
2 cba2
2 abc1
2 bbc3
What I am trying to create a metrics where ASIN will be column and Order_id will be row and for whichever ASIN falls under specific Oreder the value should be 1 else zero something similar like below.
abc1 abc3 cba2 bbc3
Order id
1 1 1 0 0
2 1 0 1 1
I tried following to do that using pandas.
bskt = pd.pivot_table(df,index='Order_Id', columns='ASIN',
fill_value = 0)
But this is not returning the desire result. Please let me know what might I am doing wrong here.
Alternatively I added a new column quantity and keep the default value of 1 for all rows in it.
I tried below
bskt = pd.pivot_table(df,index='Order_Id',values='Quantity', columns='ASIN',
fill_value = 0)
But this is also not giving the correct result.