There is a following dataframe:
id data class text
0 1.1,2.2,3.0 a, b, c 1.1 is 2.2 or 3.0
1 4.2 d 4.2 is ok
2 3.5 a 3.5 is good
3 1.5, 2.7 b, b 1.5 and 2.7 is product
4 3 c prices is 3
I want to split the above dataframe into following dataframe. for example, row 0: 1.1,2.2,3.0 which class is a, b, c respectively. so the row can be split into three rows. The same as row 3 can split into two rows. The position columns is the data position in the data column, for example, 1.1 is the position 0 in the [1.1,2.2, 3.0] The final dataframe which I want is as following.
id data position class text
0 1.1 0 a 1.1 is 2.2 or 3.0
1 2.2 1 b 1.1 is 2.2 or 3.0
2 3.0 2 c 1.1 is 2.2 or 3.0
3 4.2 0 d 4.2 is ok
4 3.5 0 a 3.5 is good
5 1.5 0 b 1.5 and 2.7 is product
6 2.7 1 b 1.5 and 2.7 is product
7 3 0 c prices is 3