I have a pandas dataframe of the form:
col1 | col2 | col3 |
1 dog$cat 73
2 Inherited pig/dog 21
3 Inherited cat 99
4 Inherited weasel$dog 33
what I want is to remove Inherited
from col2, since it is just an irrelevant artifact and break the rest of the elements at the dollar sign. For example a row containing dog$cat
should be duplicated, into a row that contains just dog
and one that contains just cat
. For the above, the desired result is:
col1 | col2 | col3 |
1 dog 73
1 cat 73
2 pig/dog 21
3 cat 99
4 weasel 33
4 dog 33
How can I do this in a fast way?