I have a data frame like this,
df
col1 col2
A [1]
B [1,2]
A [2,3,4]
C [1,2]
B [4]
Now I want to create new rows based on the number of values in the col2 list where the col1 values will be same so the final data frame would look like,
df
col1 col2
A [1]
B [1]
B [2]
A [2]
A [3]
A [4]
C [1]
C [2]
B [4]
I am looking for some pandas short cuts to do it more efficiently