我们可以试用可视化包——Pyechart。
Echarts是百度开源的一个数据可视化JS库,主要用于数据可视化。
pyecharts是一个用于生成Echarts图标的类库。实际就是Echarts与Python的对接。
安装
pyecharts兼容Python2和Python3。执行代码:
pip install pyecharts(快捷键Windows+R——输入cmd)
初级图表
1.柱状图/条形图
from pyecharts import Bar attr=["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] v1=[5,20,36,10,75,90] v2=[10,25,8,60,20,80] bar=Bar("各商家产品销售情况") bar.add("商家A",attr,v1,is_stack=True) bar.add("商家B",attr,v2,is_stack=True) bar#bar.render()
2.饼图
from pyecharts import Pie attr=["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","鞋子"] v1=[11,12,13,10,10,10] pie=Pie("各产品销售情况") pie.add("",attr,v1,is_label_show=True) pie #pie.render()
3.圆环图
from pyecharts import Pie attr=["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","鞋子"] v1=[11,12,13,10,10,10] pie=Pie("饼图—圆环图示例",title_pos="center") pie.add("",attr,v1,radius=[40,75],label_text_color=None, is_label_show=True,legend_orient="vertical", legend_pos="left") pie
4.散点图
from pyecharts import Scatter v1=[10,20,30,40,50,60] v2=[10,20,30,40,50,60] scatter=Scatter("散点图示例") scatter.add("A",v1,v2) scatter.add("B",v1[::-1],v2) scatter
5.仪表盘
from pyecharts import Gauge gauge=Gauge("业务指标完成率—仪表盘") gauge.add("业务指标","完成率",66.66) gauge
6.热力图
import random from pyecharts import HeatMap x_axis=[ "12a","1a","2a","3a","4a","5a","6a","7a","8a","9a","10a","11a", "12p","1p","2p","3p","4p","5p","6p","7p","8p","9p","10p","11p",] y_axis=[ "Saturday","Friday","Thursday","Wednesday","Tuesday","Monday","Sunday"] data=[[i,j,random.randint(0,50)] for i in range(24) for j in range(7)] heatmap=HeatMap() heatmap.add("热力图直角坐标系",x_axis,y_axis,data,is_visualmap=True, visual_text_color="#000",visual_orient="horizontal") heatmap
高级图表
1.漏斗图
from pyecharts import Funnel attr=["潜在","接触","意向","明确","投入","谈判","成交"] value=[140,120,100,80,60,40,20] funnel=Funnel("销售管理分析漏斗图") funnel.add("商品",attr,value,is_label_show=True, label_pos="inside",label_text_color="#fff") funnel
2.词云图
from pyecharts import WordCloud name=[ "Sam s Club","Macys","Amy Schumer","Jurassic World","Charter Communications", "Chick Fil A","Planet Fitness","Pitch Perfect","Express","Home","Johnny Depp", "Lena Dunham","Lewis Hamilton","KXAN","Mary Ellen Mark","Farrah Abraham", "Rita Ora","Serena Williams","NCAA baseball tournament","Point Break" ] value=[ 10000,6181,4386,4055,2467,2244,1898,1484,1112, 965,847,582,555,550,462,366,360,282,273,265] wordcloud=WordCloud(width=1300,height=620) wordcloud.add("",name,value,word_size_range=[20,100]) wordcloud
3.组合图
from pyecharts import Line,Pie,Grid line=Line("折线图",width=1200) attr=["周一","周二","周三","周四","周五","周六","周日"] line.add("最高气温",attr,[11,11,15,13,12,13,10], mark_point=["max","min"],mark_line=["average"]) line.add("最低气温",attr,[1,-2,2,5,3,2,0], mark_point=["max","min"],mark_line=["average"], legend_pos="20%") attr=["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] v1=[11,12,13,10,10,10] pie=Pie("饼图",title_pos="55%") pie.add("",attr,v1,radius=[45,65],center=[65,50], legend_pos="80%",legend_orient="vertical") grid=Grid() grid.add(line,grid_right="55%") grid.add(pie,grid_left="60%") grid
以上这篇使用Python快速制作可视化报表的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
标签:
Python,可视化,报表
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“使用Python快速制作可视化报表的方法”评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?
更新动态
2024年11月26日
2024年11月26日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]