python3的hello world
最近需要用echarts画带数据点的箱型图,然而echarts5.1的版本只有带离散点的箱型图,像这种
我需要这种,本人水平有限,想不到怎么用echarts实现下面的图形的绘制
经过查资料,发现可以用python3的seaborn实现
import seaborn as sns import matplotlib.pyplot as plt fig=plt.figure(figsize=(20,5)) # fig.patch.set_facecolor('grey') sns.set(style="darkgrid") # 加载示例数据集,把数据集下载到本地,指定加载路径 df = sns.load_dataset('iris',data_home="E:\code\learn-python3\seaborn-data-master") df.head() print(df) # 添加扰动点 # boxplot ax = sns.boxplot(x='species', y='sepal_length', data=df) # add stripplot ax = sns.stripplot(x='species', y='sepal_length', data=df, color="orange", jitter=0.2, size=4) # add title plt.title("Boxplot with jitter", loc="top") # show the graph # plt.show() plt.savefig('1.jpg')
顺便把用到的python3知识记录下
#查询mysql数据库 import pymysql db = pymysql.connect(host="127.0.0.1",user="root", password="",port=3306, database="test",charset='utf8') cursor = db.cursor() sql="select * from tb_chinese_poems limit 5" # sql语句 try: cursor.execute(sql) results =cursor.fetchall() # 获取数据 for row in results : print(row) except: print("Error: unable to fecth data")
#发送请求 import requests url="http://localhost/test.php" response=requests.get(url,params={"p1":1}) print(response.text)
#接收命令行参数 import sys print(sys.argv)
分类:
python3
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix