I need to create new rows in a pandas
dataframe based on a value that occurs in a specific column.
The pattern to create the Split is that there is a semi colon that indicates where I need to initiate a new row.
df
animal cat;dog;cat
animal dog
animal fish
color black;green
color red
desired_df
animal cat
animal dog
animal cat
animal dog
animal fish
color black
color green
color red
I have seen solutions that use pandas split to create new columns or rows using a given character or values in the df (such as here: and here: ), however, I have not seen a solution that does this with text values. I have also seen solutions (as well as one that I requested myself here) that is able to accurately fill in the null values in pandas. However, I need to combine these two techniques and it is not clear to me if this is feasible to do in a one-liner (or two).