【发布时间】:2019-12-25 13:26:19
【问题描述】:
我有一个这样的数据框:
A
0 Please wait outside of the house
1 A glittering gem is not enough.
2 The memory we used to share is no longer coher...
3 She only paints with bold colors; she does not...
我有一组关键字:
keywords = ["of","is","she"]
如何为每个关键字创建一个列,其中包含该关键字在我的数据框的每个句子中出现的次数?它看起来像:
A of is she
0 Please wait outside of the house 1 0 0
1 A glittering gem is not enough. 0 1 0
2 The memory we used to share is no longer coher... 0 1 0
3 She only paints with bold colors; she does not... 0 0 2
注意:我查看了how to count specific words from a pandas Series?,但它没有回答我的问题。
【问题讨论】: