Reputation: 57
I have DataFrame from DB.
id | values |
---|---|
1 | 32,4;12,4|36,8;14,1|38,1;15 |
2 | 10,15;16,3579|11,9;20,537 |
3 | 1,5;2,1|1,8;2,4|1,9;2,9 |
How do i get?
id | column1 | column2 | column3 | colum4 | .... | xxx |
---|---|---|---|---|---|---|
1 | 32,4 | 12,4 | 36,8 | 14,1 | 38,1 | 15 |
2 | 10,15 | 16,3579 | 11,9 | 20,537 | NULL | NULL |
3 | 1,5 | 2,1 | 1,8 | 2,4 | 1,9 | 2,9 |
Thx.
Upvotes: 1
Views: 34
Reputation: 2819
You can try with:
df['values']=df['values'].str.replace('|', ';')
df['values'].str.split(';',expand=True)
Upvotes: 1