pandas词频统计
pandas词频统计
keyword_Obj={
"新能源":"新能源",
"新能源汽车":"新能源汽车",
"汽车":"汽车"
}
for key,value in keyword_Obj.items():
print(key,'----',value)
df[key]=df['content'].str.findall(r'{pattern}'.format(pattern=value)).str.len()
### 参考
[python – How to do word count on pandas dataframe – Stack Overflow](https://stackoverflow.com/questions/54397096/how-to-do-word-count-on-pandas-dataframe)
评论列表(1条)
[Word Counts in Pandas Data Frames – Predictive Hacks](https://predictivehacks.com/?all-tips=word-counts-in-pandas-data-frames)