import pandas as pd

df = pd.read_csv("F:\\python3_pachongAndDatareduce\\data\\pandas data\\taobao_data.csv")
print(df.head())
data = df.drop(["宝贝","卖家"],axis=1).groupby(["位置"]).mean().sort_values(["成交量"],ascending=False)
print(data.head())

import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt

df = pd.read_csv("F:\\python3_pachongAndDatareduce\\data\\pandas data\\taobao_data.csv")
data_mean = df.drop(["宝贝","卖家"],axis=1).groupby(["位置"]).mean().sort_values(["成交量"],ascending=False)
print(data_mean.head())

mpl.style.use("ggplot")
fig,(ax1,ax2) = plt.subplots(1,2,figsize=(12,4))
data_mean.价格.plot(kind="barh",ax=ax1)
ax1.set_xlabel("各省份平均价格")
data_mean.成交量.plot(kind="barh",ax=ax2)
ax2.set_xlabel("各省份平均成交量")
fig.tight_layout()
plt.show()

import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt

df = pd.read_csv("F:\\python3_pachongAndDatareduce\\data\\pandas data\\taobao_data.csv")
data_mean = df.drop(["宝贝","卖家"],axis=1).groupby(["位置"]).mean().sort_values(["成交量"],ascending=False)
print(data_mean.head())
s = data_mean.成交量
mpl.style.use("ggplot")
fig,axes = plt.subplots(2,2,figsize=(10,10))
s.plot(ax=axes[0][0],kind="line",title="line")
s.plot(ax=axes[0][1],kind="bar",title="bar")
s.plot(ax=axes[1][0],kind="box",title="box")
s.plot(ax=axes[1][1],kind="pie",title="pie")
fig.tight_layout()
plt.show()

import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt

df = pd.read_csv("F:\\python3_pachongAndDatareduce\\data\\pandas data\\taobao_data.csv")
a = df.价格
b = df.成交量
mpl.style.use("ggplot")
fig,axes = plt.subplots(1,1,figsize=(12,4))
axes.scatter(a,b)
axes.set_xlabel("价格")
axes.set_ylabel("成交量")
fig.tight_layout()
plt.show()

import json
from pyecharts import Pie

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\pies.json")
data = json.load(f)
print(data)
name = data["name"]
print(name)
sales = data["sales"]
print(sales)
sales_volume = data["sales_volume"]
print(sales_volume)

import json
from pyecharts import Pie

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\pies.json")
data = json.load(f)
name = data["name"]
sales = data["sales"]
sales_volume = data["sales_volume"]
pie = Pie("衣服清洗剂市场占比",title_pos="left",width=800)
pie.add("成交量",name,sales_volume,center=[25,50],is_random=True,radius=[30,75],rosetype="radius")
pie.add("销售额",name,sales,center=[75,50],is_random=True,radius=[30,75],rosetype="area",is_legend_show=True,is_label_show=True)
pie.show_config()
pie.render("E:\\rose.html")

import json
from pyecharts import Pie

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\pies.json")
data = json.load(f)
name = data["name"]
sales = data["sales"]
sales_volume = data["sales_volume"]
pie = Pie("",width=800)
pie.add("",name,sales,is_label_show=True)
pie.render("E:\\pie.html")

import json
from pyecharts import Funnel

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\pies.json")
data = json.load(f)
name = data["name"]
sales = data["sales"]
sales_volume = data["sales_volume"]
funnle = Funnel("",width=800)
funnle.add("成交量",name,sales_volume,is_label_show=True,label_pos="inside",label_text_color="#fff")
funnle.render("E:\\funnle.html")

import json
from pyecharts import Bar

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\pies.json")
data = json.load(f)
name = data["name"]
sales = data["sales"]
sales_volume = data["sales_volume"]
bar = Bar("衣服清洗剂市场占比柱形图",width=800)
bar.add("成交量",name,sales_volume,center=[25,50],mark_point=["average"])
bar.add("销售额",name,sales,center=[25,50],mark_point=["max","min"])
bar.render("E:\\bar.html")

import json
from pyecharts import Bar

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\pies.json")
data = json.load(f)
name = data["name"]
sales = data["sales"]
sales_volume = data["sales_volume"]
bar = Bar("衣服清洗剂市场占比柱形图",width=800)
bar.add("成交量",name,sales_volume,center=[25,50],mark_point=["average"],is_stack=True)
bar.add("销售额",name,sales,center=[25,50],mark_point=["max","min"],is_stack=True)
bar.render("E:\\bar01.html")

import json
from pyecharts import Bar

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\pies.json")
data = json.load(f)
name = data["name"]
sales = data["sales"]
sales_volume = data["sales_volume"]
bar = Bar("衣服清洗剂市场占比柱形图",width=800)
bar.add("成交量",name,sales_volume,center=[25,50],mark_point=["average"],is_stack=True,is_convert=True)
bar.add("销售额",name,sales,center=[25,50],mark_point=["max","min"],is_stack=True,is_convert=True)
bar.render("E:\\bar_convert.html")

import json
from pyecharts import Bar

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\lines.json")
data = json.load(f)
print(data)
date = data["date"]
print(date)
sales1 = data["sales1"]
print(sales1)
sales2 = data["sales2"]
print(sales2)

import json
from pyecharts import Line

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\lines.json")
data = json.load(f)
date = data["date"]
sales1 = data["sales1"]
sales2 = data["sales2"]
line = Line("洗衣液月销售情况")
line.add("成交量",date,sales1,mark_point=["average","max","min"],mark_point_symbol="diamond",mark_point_textcolor="#40ff27")
line.add("销售额",date,sales2,mark_point=["max"],is_smooth=True,mark_line=["max","average"],mark_point_symbol="arrow",mark_point_symbolsize=40)
line.render("E:\\line.html")

import json
from pyecharts import Line

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\lines.json")
data = json.load(f)
date = data["date"]
sales1 = data["sales1"]
sales2 = data["sales2"]
line = Line("洗衣液月销售情况")
line.add("成交量",date,sales1,mark_point=["average","max","min"],mark_point_symbol="diamond",is_label_show=True)
line.add("销售额",date,sales2,mark_point=["max"],is_stack=True,mark_line=["max","average"],is_label_show=True)
line.render("E:\\linestate.html")

import json
from pyecharts import Line

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\lines.json")
data = json.load(f)
date = data["date"]
sales1 = data["sales1"]
sales2 = data["sales2"]
line = Line("洗衣液月销售情况")
line.add("成交量",date,sales1,is_step=True,is_label_show=True)
line.add("销售额",date,sales2,is_step=True,is_label_show=True)
line.render("E:\\linestep.html")

import json
from pyecharts import Line

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\lines.json")
data = json.load(f)
date = data["date"]
sales1 = data["sales1"]
sales2 = data["sales2"]
line = Line("洗衣液月销售情况")
line.add("成交量",date,sales1,is_fill=True,area_opacity=0.4)
line.add("销售额",date,sales2,is_fill=True,area_opacity=0.2,area_color="#000")
line.render("E:\\linefill.html")

import json
from pyecharts import Gauge

gauge = Gauge("目标完成率")
gauge.add("任务指标","完成率",80.2)
gauge.render("E:\\gauge.html")

import json
from pyecharts import Liquid

liquid = Liquid("水球图")
liquid.add("水球",[0.82,0.75])
liquid.render("E:\\liquid.html")

import json
import numpy as np
import pandas as pd

from pyecharts import WordCloud

wd = pd.read_csv("F:\\python3_pachongAndDatareduce\\data\\cp.csv",header=0)
print(np.shape(wd))
print(wd.head())
catename = [i[0] for i in wd[["关键词"]].values]
value = [int(i[0]) for i in wd[["词频"]].values]
wordcloud = WordCloud(width=1200,height=600)
wordcloud.add("",catename,value,word_size_range=[10,120],shape="star")
wordcloud.render("E:\\wordcloud.html")

import json
from pyecharts import Line

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\scatters.json")
data = json.load(f)
print(data)
xs = data["xs"]
print(xs)
gb = data["gb"]
print(gb)

import json
from pyecharts import Scatter

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\scatters.json")
data = json.load(f)
xs = data["xs"]
gb = data["gb"]
scatter = Scatter("销售额与高质量宝贝数")
scatter.add("关系",xs,gb)
scatter.render("E:\\scatter.html")

from pyecharts import Boxplot

x_axis = ["销售额"]
y_axis = [[169,126,248,263,265,273,248,241,326,334,479,347]]

boxplot = Boxplot("箱形图")
_yaxis = boxplot.prepare_data(y_axis)
boxplot.add("boxplot",x_axis,_yaxis)
boxplot.render("E:\\boxplot.html")

import json
from pyecharts import Bar,Line,Overlap

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\overlaps.json")
data = json.load(f)
print(data)
date = data["date"]
print(date)
sales1 = data["sales1"]
print(sales1)
sales2 = data["sales2"]
print(sales2)

import json
from pyecharts import Bar,Line,Overlap

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\overlaps.json")
data = json.load(f)
date = data["date"]
sales1 = data["sales1"]
sales2 = data["sales2"]

bar = Bar("Line-Bar")
bar.add("Bar",date,sales1)
line = Line()
line.add("Line",date,sales2)

overlap = Overlap()
overlap.add(bar)
overlap.add(line)
overlap.render("E:\\linebar.html")

import json
from pyecharts import Bar3D

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\bar3ds.json")
datas = json.load(f)
x_axis = datas["x_axis"]
y_axis = datas["y_axis"]
data = datas["data"]
range_color = datas["range_color"]

bar3d = Bar3D("3D柱状图",width=1200,height=600)
bar3d.add("",x_axis,y_axis,[[d[1],d[0],d[2]] for d in data],is_visualmap=True,visual_range=[0,20],visual_range_color=range_color)
bar3d.render("E:\\3dbar.html")

import json
from pyecharts import Bar3D

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\bar3ds.json")
datas = json.load(f)
x_axis = datas["x_axis"]
y_axis = datas["y_axis"]
data = datas["data"]
range_color = datas["range_color"]

bar3d = Bar3D("3D柱状图",width=1200,height=600)
bar3d.add("",x_axis,y_axis,[[d[1],d[0],d[2]] for d in data],is_visualmap=True,visual_range=[0,20],
visual_range_color=range_color,grid3d_width=200,grid3d_depth=80,is_grid3d_roate=True)
bar3d.render("E:\\3dbar01.html")

import json
from pyecharts import Bar3D

f = open("F:\\python3_pachongAndDatareduce\\data\\pyecharts JSONData\\datas\\bar3ds.json")
datas = json.load(f)
x_axis = datas["x_axis"]
y_axis = datas["y_axis"]
data = datas["data"]
range_color = datas["range_color"]

bar3d = Bar3D("3D柱状图",width=1200,height=600)
bar3d.add("",x_axis,y_axis,[[d[1],d[0],d[2]] for d in data],is_visualmap=True,visual_range=[0,20],
visual_range_color=range_color,grid3d_width=200,grid3d_depth=80,is_grid3d_speed=180)
bar3d.render("E:\\3dbar02.html")

吴裕雄 python 数据可视化的更多相关文章

  1. Python数据可视化编程实战——导入数据

    1.从csv文件导入数据 原理:with语句打开文件并绑定到对象f.不必担心在操作完资源后去关闭数据文件,with的上下文管理器会帮助处理.然后,csv.reader()方法返回reader对象,通过 ...

  2. Python数据可视化——使用Matplotlib创建散点图

    Python数据可视化——使用Matplotlib创建散点图 2017-12-27 作者:淡水化合物 Matplotlib简述: Matplotlib是一个用于创建出高质量图表的桌面绘图包(主要是2D ...

  3. Python数据可视化-seaborn库之countplot

    在Python数据可视化中,seaborn较好的提供了图形的一些可视化功效. seaborn官方文档见链接:http://seaborn.pydata.org/api.html countplot是s ...

  4. Python数据可视化编程实战pdf

    Python数据可视化编程实战(高清版)PDF 百度网盘 链接:https://pan.baidu.com/s/1vAvKwCry4P4QeofW-RqZ_A 提取码:9pcd 复制这段内容后打开百度 ...

  5. 【数据科学】Python数据可视化概述

    注:很早之前就打算专门写一篇与Python数据可视化相关的博客,对一些基本概念和常用技巧做一个小结.今天终于有时间来完成这个计划了! 0. Python中常用的可视化工具 Python在数据科学中的地 ...

  6. Python数据可视化的四种简易方法

    摘要: 本文讲述了热图.二维密度图.蜘蛛图.树形图这四种Python数据可视化方法. 数据可视化是任何数据科学或机器学习项目的一个重要组成部分.人们常常会从探索数据分析(EDA)开始,来深入了解数据, ...

  7. python --数据可视化(一)

    python --数据可视化 一.python -- pyecharts库的使用 pyecharts--> 生成Echarts图标的类库 1.安装: pip install pyecharts ...

  8. python 数据可视化

    一.基本用法 import numpy as np import matplotlib.pyplot as plt x = np.linspace(-1,1,50) # 生成-1到1 ,平分50个点 ...

  9. 【python可视化系列】python数据可视化利器--pyecharts

    学可视化就跟学弹吉他一样,刚开始你会觉得自己弹出来的是噪音,也就有了在使用python可视化的时候,总说,我擦,为啥别人画的图那么溜: [python可视化系列]python数据可视化利器--pyec ...

随机推荐

  1. caffe实现年龄及性别预测

    一.相关代码及训练好的模型 eveningglow/age-and-gender-classification: Age and Gender Classification using Convolu ...

  2. django中form页面刷新后自动提交的解决方案

    如果一个页面包含了form,同时这个form中的提交按钮是type=submit的input的时候,你刷新该页面,就会有弹窗提示是否重新提交表单,这个特性不胜其烦,常见解决方法有两个: 第一种是前端的 ...

  3. Ubuntu 16.04安装Docker-CE

    系统环境 * Ubuntu: 16.04 * Docker: 17.09.0-ce 安装步骤 1.安装Docker-CE,具体参考:https://docs.docker.com/engine/ins ...

  4. okhttp 解析respone:

    android,retrofit,okhttp,日志拦截器,使用拦截器Interceptor统一打印请求与响应的json: https://blog.csdn.net/qq_37043246/arti ...

  5. 搭建 Jest+ Enzyme 测试环境

    1.为什么要使用单元测试工具? 因为代码之间的相互调用关系,又希望测试过程单元相互独立,又能正常运行,这就需要我们对被测函数的依赖函数和环境进行mock,在测试数据输入.测试执行和测试结果检查方面存在 ...

  6. c++ auto 属性

    auto 指定符(C++11 起)   C++   C++ 语言   声明   对于变量,指定其类型将从其初始化器自动推导而出. 对于函数,指定其返回类型是尾随的返回类型或将从其 return 语句推 ...

  7. ibatis.net 循环

    if (oReqV[0]["tag"] != null && !string.IsNullOrEmpty(oReqV[0]["tag"].ToS ...

  8. MSF banner

    ____________ [%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%| $a, |%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%] [%%%%%%%%%%%%%% ...

  9. 基于bootstrap table配置的二次封装

    准备 jQuery js css 引用完毕 开始 如果对bootstrap table 的方法与事件不熟悉: Bootstrap table方法,Bootstrap table事件 <table ...

  10. 解决wxParse空格不解析的问题

    遇到的问题: 相似问题:https://blog.csdn.net/qq_41619741/article/details/85774865 http://html51.com/info-41786- ...