📌  相关文章
📜  py - 计算列中是否存在单词 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:39.437000             🧑  作者: Mango

代码示例1
words = 'one two three'.split()

df.assign(counts=df.texts.str.count('|'.join(words)))

        texts  counts
0  throne one       2
1     bar one       1
2     foo two       1
3   bar three       1
4     foo two       1
5     bar two       1
6     foo one       1
7   foo three       1
8   one three       2