I have below data in csv.
dataCenter,customer,companyID,UID,uba
dc1,customer1,companyID1,uid1,"uba1,uba2,uba3,uba4"
dc2,customer2,companyID1,uid2,"ubaA"
dc3,customer3,companyID3,uid3,"uba1,uba4"
dc4,customer4,companyID4,uid4,"uba1,uba2,uba5,uba6,uba10"
Now I want to convert the data to below format, assign the multi-values in 'uba' column into other new columns.
dataCenter,customer,companyID,UID,action1,action2,action3,action4,action5,...,
dc1,customer1,companyID1,uid1,uba1,uba2,uba3,uba4
dc2,customer2,companyID1,uid2,uba
dc3,customer3,companyID3,uid3,uba1,uba4
dc4,customer4,companyID4,uid4,uba1,uba2,uba5,uba6,uba10,uba11,uba12,uba13
I have tried below,but doesn't work.
a = a.explode('uba')
a = pd.concat([a,pd.DataFrame(a.pop('uba').tolist(),index=a.index)],axis=1)
I don't want to use str.split('',expand=True) as the performance is really bad when data is large.
is there any other good option with good performance for me?