I am using python and I have a dataframe named "noshow" with 5 columns such as ,
- Phone - float64
- Name - object
- Total Order Counts - int64
- Total Bill Value - float64
- List_of_Order_Id - object
5th column "List_of_Order_Id" has the list of order ids per row(customer) like below,
In [11]: noshow
Out[11]:
Mobile ... List_of_Order_Id
0 9.163820e+08 ... 21810
1 9.179049e+08 ... 23387
2 9.183748e+08 ... 21767
3 9.186110e+08 ... 23457
4 9.187790e+08 ... 23117,23163
.. ... ... ...
353 9.970647e+09 ... 21549
354 9.971940e+09 ... 22753
355 9.994742e+09 ... 21505,21836,22291,22539,22734
356 9.994964e+09 ... 22348
357 9.994997e+09 ... 21100,21550
[358 rows x 5 columns]
Now, I want to automate the splitting of "List_of_Order_Id" column at each comma and create a new column for each of the value using loop or whatever solution available.
For example, if in one of the row of List_of_Order_Id column out of 358 rows has "n" order id values and that is the maximum number of order ids per customer then I want to split it into "n" columns and I want to name each of the columns as "Order_Id_1", "Order_Id_2", ......., "Order_Id_n" with the numbers as suffix like mentioned.
Kindly help! Thanks in advance.