擅长:python、mysql、java
<p>在按空格拆分字符串后,可以将列表理解与<code>any</code>一起使用。这种方法不包括“导管”,因为它包括“猫”。在</p>
<pre><code>mask = [any(i in words for i in b['dirty_words'].values) \
for words in a['text'].str.split().values]
print(a[mask])
text
0 the cat jumped over the hat
2 i lost my dog in the fog
</code></pre>