当前位置:网站首页>pyechart 绘制词云图
pyechart 绘制词云图
2022-06-22 00:45:00 【呆萌的代Ma】
最后绘制的时候要把格式调整为:[("python",3),("技术",4)]这种格式
示例代码
from pyecharts.faker import Faker
def plot_word(words_list: list):
from pyecharts.charts import WordCloud
freq = {
}
for value in words_list:
words_list = value.split(' ')
for word in words_list:
if word in freq.keys():
freq[word] += 1
else:
freq[word] = 1
# dict 转 tuple list
keyword_list = []
for key, value in freq.items():
keyword_list.append((key, value))
# 使用pyechart开始绘图
pyechart_word_cloud = WordCloud()
pyechart_word_cloud.add('', keyword_list, shape='circle')
pyechart_word_cloud.render("pyechart_word_cloud.html")
plot_word(['技术'] * 4 + ["python"] * 3 + ["word", 'cloud'] * 2 + ['数据', '分析'] + Faker.choose())
效果如下:
边栏推荐
- Yang Bing: oceanbase helps digital transformation, and native distributed database becomes the first choice for core system
- Virtual variables and formatting characters in debugging
- ROS 2 驱动程序现在可用于 ABB 的机械臂
- MySQL 8.0 新特性梳理汇总
- 4273. 链表合并
- 2011. 执行操作后的变量值
- 【Redis】事件驱动框架源码分析(单线程)
- Huawei cloud releases desktop ide codearts
- php-admin部署-解决全部错误
- MySQL dump auto backup database shell script
猜你喜欢
![[ÑÖÏ Simulation Competition] fading (matrix acceleration, cyclic convolution, Gauss elimination)](/img/4a/9dfcb699e36f67e14c036e3ae26417.png)
[ÑÖÏ Simulation Competition] fading (matrix acceleration, cyclic convolution, Gauss elimination)

带你区分几种并行

Using SSM framework to realize user login
![[cyw20189] VII. Detailed explanation of HCI command format](/img/ba/c61d4868e6c5da8460541c62649880.png)
[cyw20189] VII. Detailed explanation of HCI command format

今日内容

机器学习 Pytorch实现案例 LSTM案例(航班人数预测)
![[redis] event driven framework source code analysis (single thread)](/img/72/ae961423832f217324007c81b6f9e5.png)
[redis] event driven framework source code analysis (single thread)

LeetCode 5242. 兼具大小写的最好英文字母

4g/wifi energy consumption metering socket - monitoring voltage, current and power

Standing at the digital tuyere, how can tooling enterprises "fly"
随机推荐
3371. 舒适的奶牛
[Others] analysis of got and PLT in ELF
Sqlite3数据库的timestamp类型的使用注意事项
想加入大厂?看这篇文章也许会帮助到你
【Redis】事件驱动框架源码分析(单线程)
LeetCode 5242. Best English letters with both upper and lower case
Huawei cloud releases desktop ide codearts
Some introduction and transplantation of lvgl
ROS 2 driver is now available for ABB manipulator
3 minutes, take you to play with chat robot automation [top template]
03 fastjson resolving circular references
==和equals的区别
English语法_副词 - loud /aloud / loudly
修改字典的方法
LeetCode 5218. Sum of integers with K digits (enumeration)
After the counter is completed, you want to count the results whose string length is greater than 2
4274. 后缀表达式
Differences among active window, focused window and foreground window
The appearance, space, safety and power are all upgraded. The xinjietu x70s will be put on the market from 87900 yuan
SAP MM 进口采购业务中供应商多送或者少送场景的处理