【发布时间】:2017-07-25 05:21:58
【问题描述】:
my_list=["one","is"]
df
Out[6]:
Name Story
0 Kumar Kumar is one of the great player in his team
1 Ravi Ravi is a good poet
2 Ram Ram drives well
如果 my_list 中的任何项目出现在“故事”列中,我需要获取所有项目的出现次数。
my_desired_output
new_df
word count
one 1
is 2
我实现了提取包含 my_list 中任何项目的行
mask=df1["Story"].str.contains('|'.join(my_list),na=False) but now I am trying get the counts of each word in my_list
【问题讨论】:
标签: python pandas dataframe data-analysis