【发布时间】:2019-12-19 03:31:34
【问题描述】:
我有一个包含多行评论和文本列的数据框。我还有一个包含单词的列表。我想要一个 for 循环来检查数据帧的每一行,以总结从列表中找到的单词数。我想保持每行总和由行分隔并将结果放入新的结果数据框中。
#Data Frame
Review Text
1 I like to run and play.
2 I eat cookies.
3 I went to swim in the pool.
4 I like to sleep.
5 I like to run, play, swim, and eat.
#List Words
Run
Play
Eat
Swim
#Result Data Frame
Review Count
1 2
2 1
3 1
4 0
5 4
【问题讨论】: