📅  最后修改于: 2022-03-11 14:46:39.437000             🧑  作者: Mango
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