我有一个形式的熊猫数据框:
col1 | col2 | col3 |
1 dog$cat 73
2 Inherited pig/dog 21
3 Inherited cat 99
4 Inherited weasel$dog 33
我想要的是Inherited从 col2 中删除,因为它只是一个不相关的工件并破坏美元符号处的其余元素。例如,dog$cat应将包含的行复制到包含 just 的行dog和包含 just的行cat。对于上述情况,期望的结果是:
col1 | col2 | col3 |
1 dog 73
1 cat 73
2 pig/dog 21
3 cat 99
4 weasel 33
4 dog 33
我怎样才能快速做到这一点?