python - 可视化 Pandas 系列中出现频率最高的单词
问题描述
我有一个熊猫系列,想绘制最常用的词。
我的系列已经被标记并删除了停用词。
series
:
0 [laptop, sit, 4, star, similarly, price, compa...
1 [order, monitor, want, makeshift, area, powerf...
2 [monitor, great, deal, price, size, ., use, of...
3 [buy, height, adjustment, ., swivel, ability, ...
4 [work, month, die, ., 5, call, hp, support, nu...
...
30618 [great, deal]
30619 [pour, le, travail]
30620 [business, use]
30621 [good, size]
30622 [pour, mon, ordinateur.plus, grande, image.vra...
Name: text_body, Length: 30623, dtype: object
我想使用 seaborn 来绘制代表热门单词的图表。
counter=Counter(str(series))
most=counter.most_common()
x=[]
y=[]
for word,count in most[:20]:
x.append(word)
y.append(count)
sns.set(rc={'figure.figsize':(10,10)})
sns.barplot(x=y,y=x)
该图仅显示顶部字符而不是单词。我做错了什么?
解决方案
推荐阅读
- javascript - 我想要一条警报消息。输入您的姓名点击按钮,如添加。如果 textplace 为空,则显示错误消息
- php - Laravel Eloquent 关系:如何使用 Laravel 雄辩模型关系从孩子那里获取父母信息?
- sql - 在 Oracle 表中搜索奇怪的字符
- python - 将几条推文放入数据框中
- typo3 - 在 Fluid 布局文件中嵌入自定义 ext:form
- macos - SwitfUI:在 macOS 上访问特定场景的 ViewModel
- mysql - 在 macos Catalina 上安装多个 MySQL 实例
- sql - 如何将分组变量放入 SQL/ 中的列
- wso2 - WSO2,不允许订阅者创建应用程序
- angular - 无法将 Amazon Chime VideoTile 绑定到