识别pandas列

时间:2017-11-27 15:21:46

标签: python pandas

我有一个tsv文件如下。

id    ingredients    recipe
code1  egg, butter   beat eggs. add unsalted butter
code2  tim tam, butter  beat tim tam. add butter
code3  coffee, sugar   add coffee and sugar and mix
code4  sugar, fresh goat milk   beat sugar and milk together

如果条目包含ingredientsrecipe列中的下述字词,我想删除这些条目。

mylist = ['tim tam', 'unsalted butter', 'fresh goat milk']

我的输出应如下所示。

id    ingredients    recipe
code3  coffee, sugar   add coffee and sugar and mix

有没有办法用大熊猫做到这一点?请帮帮我!

0 个答案:

没有答案