欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python?pyecharts案例超市4年數(shù)據(jù)可視化分析

 更新時間:2022年08月14日 15:19:49   作者:lanxiaofang  
這篇文章主要介紹了Python?pyecharts案例超市4年數(shù)據(jù)可視化分析,文章圍繞主題展開詳細(xì)的內(nèi)容介紹,具有一定的參考價值,需要的小伙伴可以參考一下

一、數(shù)據(jù)描述

數(shù)據(jù)集中9994條數(shù)據(jù),橫跨1237天,銷售額為2,297,200.8603美元,利潤為286,397.0217美元,他們的庫存中有1862件獨(dú)特的物品,它們被分為3類,所有這些物品都在美國4個地區(qū)的49個州銷售,來著793位客戶的5009個訂單。

數(shù)據(jù)集: Superstore.csv 來源:kaggle

一共21列數(shù)據(jù),每一列屬性描述如下:

  • Row ID => 每一行唯一的ID.
  • Order ID => 每個客戶的唯一訂單ID.
  • Order Date => 產(chǎn)品的訂單日期.
  • Ship Date => 產(chǎn)品發(fā)貨日期.
  • Ship Mode=> 客戶指定的發(fā)貨模式.
  • Customer ID => 標(biāo)識每個客戶的唯一ID.
  • Customer Name => 客戶的名稱.
  • Segment => The segment where the Customer belongs.
  • Country => 客戶居住的國家.
  • City => 客戶居住的城市.
  • State => 客戶所在的州.
  • Postal Code => 每個客戶的郵政編碼.
  • Region => “客戶”所屬地區(qū).
  • Product ID => 產(chǎn)品的唯一ID.
  • Category => 所訂購產(chǎn)品的類別.
  • Sub-Category => 所訂購產(chǎn)品的子類別.
  • Product Name => 產(chǎn)品名稱
  • Sales =>產(chǎn)品的銷售.
  • Quantity => 產(chǎn)品數(shù)量.
  • Discount => 提供折扣.
  • Profit => 已發(fā)生的利潤/虧損.

1、數(shù)據(jù)概覽

9994行,21列數(shù)據(jù)

print(df.info())
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 9994 entries, 0 to 9993
Data columns (total 21 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Row ID 9994 non-null int64
1 Order ID 9994 non-null object
2 Order Date 9994 non-null object
3 Ship Date 9994 non-null object
4 Ship Mode 9994 non-null object
5 Customer ID 9994 non-null object
6 Customer Name 9994 non-null object
7 Segment 9994 non-null object
8 Country 9994 non-null object
9 City 9994 non-null object
10 State 9994 non-null object
11 Postal Code 9994 non-null int64
12 Region 9994 non-null object
13 Product ID 9994 non-null object
14 Category 9994 non-null object
15 Sub-Category 9994 non-null object
16 Product Name 9994 non-null object
17 Sales 9994 non-null float64
18 Quantity 9994 non-null int64
19 Discount 9994 non-null float64
20 Profit 9994 non-null float64
dtypes: float64(3), int64(3), object(15)
memory usage: 1.6+ MB
None

二、數(shù)據(jù)預(yù)處理

1、導(dǎo)入包和數(shù)據(jù)

import pandas as pd
from pyecharts.charts import *
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode

data = pd.read_csv(r'./data/Superstore.csv')

2、列名重命名

重命名后的列名:

data.columns = ['行ID', '訂單ID', '訂單日期', '發(fā)貨日期', '發(fā)貨方式', '客戶ID', '客戶名稱', '客戶類型', '國家', '城市', '州', '郵政編碼', '所屬區(qū)域', '產(chǎn)品ID',
'產(chǎn)品類別', '產(chǎn)品子類別', '產(chǎn)品名稱', '銷售額', '產(chǎn)品數(shù)量', '提供折扣', '利潤/虧損']

3、提取數(shù)據(jù)中時間,方便后續(xù)分析繪圖

data['年份'] = data['訂單日期'].apply(lambda x: x[-4:])
data['日期'] = pd.to_datetime(data['訂單日期'], format='%m/%d/%Y')
data['月份'] = data['日期'].dt.month
data['年-月'] = data['年份'].astype('str') + '-' + data['月份'].astype('str')

三、數(shù)據(jù)可視化

1、美國各個地區(qū)銷售額的分布(地圖)

包含:Order_Date Sales Quantity Profit year month

usa_sale = data[['州', '銷售額']].groupby('州').sum().round(2).reset_index()
print(usa_sale.head())
def echarts_map(province, data, title='主標(biāo)題', subtitle='副標(biāo)題', label='圖例'):
"""
province:傳入省份List
data:傳入各省對應(yīng)的數(shù)據(jù)List
title:主標(biāo)題
subtitle:副標(biāo)題
label:圖例
"""
map_ = Map(
init_opts=opts.InitOpts(
bg_color='#080b30', # 設(shè)置背景顏色
theme='dark', # 設(shè)置主題
width='980px', # 設(shè)置圖的寬度
height='700px', # 設(shè)置圖的高度
)
)
map_.add(label, [list(i) for i in zip(province, data)],
maptype='美國'
)
map_.set_global_opts(
# 標(biāo)題設(shè)置
title_opts=opts.TitleOpts(
title=title, # 主標(biāo)題
subtitle=subtitle, # 副標(biāo)題
pos_left='center', # 標(biāo)題展示位置
title_textstyle_opts=dict(color='#fff') # 設(shè)置標(biāo)題字體顏色
),
# 圖例設(shè)置
legend_opts=opts.LegendOpts(
is_show=True, # 是否顯示圖例
pos_left='right', # 圖例顯示位置
pos_top='3%', # 圖例距離頂部的距離
orient='horizontal' # 圖例水平布局
),
visualmap_opts=opts.VisualMapOpts(max_=int(max(data)), is_piecewise=False)
)
return map_.render(title + '-' + subtitle + '.html')

echarts_map(usa_sale['州'].tolist(), usa_sale['銷售額'].tolist(), title='美國各地區(qū)銷售額分布'
, subtitle='銷售額分布地圖', label='銷售額')

2、各產(chǎn)品類別銷售額對比(柱狀圖)

pro_category = data[['產(chǎn)品類別', '銷售額', '利潤/虧損']].groupby('產(chǎn)品類別').sum().round(2).reset_index()
pro_category.head()
def echarts_bar(x, y, y2, title='主標(biāo)題', subtitle='副標(biāo)題', label='圖例', label2='圖例2'):
"""
x: 函數(shù)傳入x軸標(biāo)簽數(shù)據(jù)
y:函數(shù)傳入y軸數(shù)據(jù)
title:主標(biāo)題
subtitle:副標(biāo)題
label:圖例
"""
bar = Bar(
init_opts=opts.InitOpts(
bg_color='#080b30', # 設(shè)置背景顏色
theme='dark', # 設(shè)置主題
width='900px', # 設(shè)置圖的寬度
height='600px' # 設(shè)置圖的高度
)
)
bar.add_xaxis(x)
bar.add_yaxis(label, y,
label_opts=opts.LabelOpts(is_show=True) # 是否顯示數(shù)據(jù)
, category_gap="70%" # 柱子寬度設(shè)置
, yaxis_index=0
)
bar.add_yaxis(label2, y2,
label_opts=opts.LabelOpts(is_show=True) # 是否顯示數(shù)據(jù)
, category_gap="70%" # 柱子寬度設(shè)置
, yaxis_index=1
)
bar.set_series_opts( # 自定義圖表樣式
label_opts=opts.LabelOpts(
is_show=True,
position='top', # position 標(biāo)簽的位置 可選 'top','left','right','bottom','inside','insideLeft','insideRight'
font_size=15,
color='white',
font_weight='bolder', # font_weight 文字字體的粗細(xì) 'normal','bold','bolder','lighter'
font_style='oblique', # font_style 文字字體的風(fēng)格,可選 'normal','italic','oblique'
), # 是否顯示數(shù)據(jù)標(biāo)簽
# markpoint_opts=opts.MarkPointOpts(
# data=[
# opts.MarkPointItem(type_="min", name="最小值"), # 顯示最小值標(biāo)簽
# opts.MarkPointItem(type_="max", name="最大值"), # 顯示最大值標(biāo)簽
# opts.MarkPointItem(type_="average", name="平均值") # 顯示均值標(biāo)簽
# ]
# ),
itemstyle_opts={
"normal": {
"color": JsCode(
"""new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,color: 'rgba(0, 244, 255, 1)'}
,{offset: 1,color: 'rgba(0, 77, 167, 1)'}], false)
"""
), # 調(diào)整柱子顏色漸變
'shadowBlur': 15, # 光影大小
"barBorderRadius": [100, 100, 100, 100], # 調(diào)整柱子圓角弧度
"shadowColor": "#0EEEF9", # 調(diào)整陰影顏色
'shadowOffsetY': 2,
'shadowOffsetX': 2, # 偏移量
}
}
)
bar.set_global_opts(
# 標(biāo)題設(shè)置
title_opts=opts.TitleOpts(
title=title, # 主標(biāo)題
subtitle=subtitle, # 副標(biāo)題
pos_left='center', # 標(biāo)題展示位置
title_textstyle_opts=dict(color='#fff') # 設(shè)置標(biāo)題字體顏色
),
# 圖例設(shè)置
legend_opts=opts.LegendOpts(
is_show=True, # 是否顯示圖例
pos_left='right', # 圖例顯示位置
pos_top='3%', # 圖例距離頂部的距離
orient='horizontal' # 圖例水平布局
),
tooltip_opts=opts.TooltipOpts(
is_show=True, # 是否使用提示框
trigger='axis', # 觸發(fā)類型
is_show_content=True,
trigger_on='mousemove|click', # 觸發(fā)條件,點(diǎn)擊或者懸停均可出發(fā)
axis_pointer_type='cross', # 指示器類型,鼠標(biāo)移動到圖表區(qū)可以查看效果
),
yaxis_opts=opts.AxisOpts(
is_show=True,
splitline_opts=opts.SplitLineOpts(is_show=False), # 分割線
axistick_opts=opts.AxisTickOpts(is_show=False), # 刻度不顯示
axislabel_opts=opts.LabelOpts( # 坐標(biāo)軸標(biāo)簽配置
font_size=13, # 字體大小
font_weight='bolder' # 字重
),
), # 關(guān)閉Y軸顯示
xaxis_opts=opts.AxisOpts(
boundary_gap=True, # 兩邊不顯示間隔
axistick_opts=opts.AxisTickOpts(is_show=True), # 刻度不顯示
splitline_opts=opts.SplitLineOpts(is_show=False), # 分割線不顯示
axisline_opts=opts.AxisLineOpts(is_show=True), # 軸不顯示
axislabel_opts=opts.LabelOpts( # 坐標(biāo)軸標(biāo)簽配置
font_size=13, # 字體大小
font_weight='bolder' # 字重
),
),
)
bar.extend_axis(yaxis=opts.AxisOpts())
return bar.render(title + '-' + subtitle + '.html')
echarts_bar(pro_category['產(chǎn)品類別'].tolist(), pro_category['銷售額'].tolist(),
pro_category['利潤/虧損'].tolist(), title='不同產(chǎn)品類別銷售額對比', subtitle='銷售額對比柱狀圖',
label='銷售額', label2='利潤')

3、不同客戶類別銷售額對比(餅圖)

customer_sale = data[['客戶類型', '銷售額', '利潤/虧損']].groupby('客戶類型').sum().round(2).reset_index()
def echarts_pie(x, y, title='主標(biāo)題', subtitle='副標(biāo)題', label='圖例'):
pie = Pie(
init_opts=opts.InitOpts(
bg_color='#080b30', # 設(shè)置背景顏色
theme='dark', # 設(shè)置主題
width='900px', # 設(shè)置圖的寬度
height='600px'
)
)
pie.add('', [list(z) for z in zip(x, y)])
pie.set_series_opts(label_opts=opts.LabelOpts(
formatter=": {c}",
font_size='15',
font_style='oblique',
font_weight='bolder'
)
)
pie.set_global_opts(
# 標(biāo)題設(shè)置
title_opts=opts.TitleOpts(
title=title, # 主標(biāo)題
subtitle=subtitle, # 副標(biāo)題
pos_left='center', # 標(biāo)題展示位置
title_textstyle_opts=dict(color='white'), # 設(shè)置標(biāo)題字體顏色
subtitle_textstyle_opts=dict(color='white')
),
legend_opts=opts.LegendOpts(
is_show=True, # 是否顯示圖例
pos_left='right', # 圖例顯示位置
pos_top='3%', # 圖例距離頂部的距離
orient='vertical', # 圖例水平布局
textstyle_opts=opts.TextStyleOpts(
color='white', # 顏色
font_size='13', # 字體大小
font_weight='bolder', # 加粗
),
)
)
return pie.render(title + '-' + subtitle + '.html')
echarts_pie(customer_sale['客戶類型'], customer_sale['銷售額'], title='不同客戶類別銷售額對比', subtitle=' ', label='銷售額')
echarts_pie(customer_sale['客戶類型'], customer_sale['利潤/虧損'], title='不同客戶類別利潤對比', subtitle=' ', label='利潤/虧損')

4、每月各產(chǎn)品銷售額top10榜單

month_lis = data.sort_values(by='日期')['年-月'].unique().tolist()
month_sale = []
for i in month_lis:
month_data = data[data['年-月'] == i][['產(chǎn)品名稱', '銷售額']].groupby(['產(chǎn)品名稱']). \
sum().round(2).reset_index().sort_values(by='銷售額', ascending=False)[:10]
month_data = month_data.sort_values(by='銷售額', ascending=True)
# final_data = [month_data['產(chǎn)品名稱'].tolist(),month_data['銷售額'].tolist()]
month_sale.append(month_data)
# month_sale[0]
# 繪制動態(tài)榜單
# 新建一個timeline對象
def echart_line(x, y, title='主標(biāo)題', subtitle='副標(biāo)題', label='圖例'):
tl = Timeline(
init_opts=opts.InitOpts(
bg_color='#080b30', # 設(shè)置背景顏色
theme='dark', # 設(shè)置主題
width='1200px', # 設(shè)置圖的寬度
height='700px' # 設(shè)置圖的高度
)
)
tl.add_schema(
is_auto_play=True, # 是否自動播放
play_interval=1500, # 播放速度
is_loop_play=True, # 是否循環(huán)播放
)

for i, data1 in zip(x, y):
day = i
bar = Bar(
init_opts=opts.InitOpts(
bg_color='#080b30', # 設(shè)置背景顏色
theme='dark', # 設(shè)置主題
width='1200px', # 設(shè)置圖的寬度
height='700px' # 設(shè)置圖的高度
)
)
bar.add_xaxis(data1.iloc[:, 0].tolist())
bar.add_yaxis(
label,
data1.iloc[:, 1].round(2).tolist(),
category_gap="40%"
)
bar.reversal_axis()
bar.set_series_opts( # 自定義圖表樣式
label_opts=opts.LabelOpts(
is_show=True,
position="right",
font_style='oblique',
font_weight='bolder',
font_size='13',

), # 是否顯示數(shù)據(jù)標(biāo)簽
itemstyle_opts={
"normal": {
"color": JsCode(
"""new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
offset: 0,color: 'rgba(0, 244, 255, 1)'}
,{offset: 1,color: 'rgba(0, 77, 167, 1)'}], false)
"""
), # 調(diào)整柱子顏色漸變
'shadowBlur': 8, # 光影大小
"barBorderRadius": [100, 100, 100, 100], # 調(diào)整柱子圓角弧度
"shadowColor": "#0EEEF9", # 調(diào)整陰影顏色
'shadowOffsetY': 6,
'shadowOffsetX': 6, # 偏移量
}
}
)
bar.set_global_opts(
# 標(biāo)題設(shè)置
title_opts=opts.TitleOpts(
title=title, # 主標(biāo)題
subtitle=subtitle, # 副標(biāo)題
pos_left='center', # 標(biāo)題展示位置
title_textstyle_opts=dict(color='white'), # 設(shè)置標(biāo)題字體顏色
subtitle_textstyle_opts=dict(color='#white')
),
legend_opts=opts.LegendOpts(
is_show=True, # 是否顯示圖例
pos_left='right', # 圖例顯示位置
pos_top='3%', # 圖例距離頂部的距離
orient='vertical', # 圖例水平布局
textstyle_opts=opts.TextStyleOpts(
color='white', # 顏色
font_size='13', # 字體大小
font_weight='bolder', # 加粗
font_style='oblique',
),
),
tooltip_opts=opts.TooltipOpts(
is_show=True, # 是否使用提示框
trigger='axis', # 觸發(fā)類型
is_show_content=True,
trigger_on='mousemove|click', # 觸發(fā)條件,點(diǎn)擊或者懸停均可出發(fā)
axis_pointer_type='cross', # 指示器類型,鼠標(biāo)移動到圖表區(qū)可以查看效果
# formatter = '{a}<br>:{c}人' # 文本內(nèi)容
),
yaxis_opts=opts.AxisOpts(
is_show=True,
splitline_opts=opts.SplitLineOpts(is_show=False), # 分割線
axistick_opts=opts.AxisTickOpts(is_show=False), # 刻度不顯示
axislabel_opts=opts.LabelOpts( # 坐標(biāo)軸標(biāo)簽配置
font_size=13, # 字體大小
font_weight='bolder' # 字重
),
), # 關(guān)閉Y軸顯示
xaxis_opts=opts.AxisOpts(
boundary_gap=True, # 兩邊不顯示間隔
axistick_opts=opts.AxisTickOpts(is_show=True), # 刻度不顯示
splitline_opts=opts.SplitLineOpts(is_show=False), # 分割線不顯示
axisline_opts=opts.AxisLineOpts(is_show=True), # 軸不顯示
axislabel_opts=opts.LabelOpts( # 坐標(biāo)軸標(biāo)簽配置
font_size=13, # 字體大小
font_weight='bolder', # 字重
),
),
)
tl.add(bar, day)
return tl.render(title + '-' + subtitle + '.html')
# 銷售額、凈利潤在時間維度的變化(折線圖)
echart_line(month_lis, month_sale, title='每月各產(chǎn)品銷售額top10榜單', subtitle=' ', label='銷售額')

5、銷售額、凈利潤在時間維度的變化(折線圖)

sale_data = data.sort_values(by='日期')[['年份', '日期', '銷售額', '利潤/虧損']]. \
groupby(['年份', '日期']).sum().round(2).reset_index()
year_lis = sale_data['年份'].unique().tolist()
sale_data1 = sale_data[sale_data['年份'] == '2014']
sale_data2 = sale_data[sale_data['年份'] == '2015']
sale_data3 = sale_data[sale_data['年份'] == '2016']
sale_data4 = sale_data[sale_data['年份'] == '2017']
sale_data_lis = [sale_data1, sale_data2, sale_data3, sale_data4]
print(sale_data4.head())
def echarts_two_line(x, y, title='主標(biāo)題', subtitle='副標(biāo)題', label='圖例', label2='圖例2'):
"""
x: 函數(shù)傳入x軸table數(shù)據(jù)
y:函數(shù)傳入y軸dataframe集合
title:主標(biāo)題
subtitle:副標(biāo)題
label:圖例
"""
tab = Tab()
for table, data in zip(x, y):
line1 = Line(
init_opts=opts.InitOpts(
bg_color='#080b30', # 設(shè)置背景顏色
theme='dark', # 設(shè)置主題
width='1200px', # 設(shè)置圖的寬度
height='700px' # 設(shè)置圖的高度
)
)
line1.add_xaxis(data['日期'].tolist())
line1.extend_axis(yaxis=opts.AxisOpts()) # 添加一條Y軸
line1.add_yaxis(
label,
data['銷售額'].tolist(),
yaxis_index=0,
is_symbol_show=False, # 是否顯示數(shù)據(jù)標(biāo)簽點(diǎn)
is_smooth=True, # 設(shè)置曲線平滑
label_opts=opts.LabelOpts(
is_show=True, # 是否顯示數(shù)據(jù)
),
# 線條粗細(xì)陰影設(shè)置
linestyle_opts={
"normal": {
"color": "#E47085", # 線條顏色
"shadowColor": '#E4708560', # 陰影顏色和不透明度
"shadowBlur": 8, # 陰影虛化大小
"shadowOffsetY": 20, # 陰影y偏移量
"shadowOffsetX": 20, # 陰影x偏移量
"width": 7 # 線條粗細(xì)
},
},
)
line1.set_global_opts(
# 標(biāo)題設(shè)置
title_opts=opts.TitleOpts(
title=title, # 主標(biāo)題
subtitle=subtitle, # 副標(biāo)題
pos_left='center', # 標(biāo)題展示位置
title_textstyle_opts=dict(color='white'), # 設(shè)置標(biāo)題字體顏色
subtitle_textstyle_opts=dict(color='white')
),
# 圖例設(shè)置
legend_opts=opts.LegendOpts(
is_show=True, # 是否顯示圖例
pos_left='right', # 圖例顯示位置
pos_top='3%', # 圖例距離頂部的距離
orient='horizontal', # 圖例水平布局
textstyle_opts=opts.TextStyleOpts(
color='white', # 顏色
font_size='13', # 字體大小
font_weight='bolder', # 加粗
),
),
tooltip_opts=opts.TooltipOpts(
is_show=True, # 是否使用提示框
trigger='axis', # 觸發(fā)類型
is_show_content=True,
trigger_on='mousemove|click', # 觸發(fā)條件,點(diǎn)擊或者懸停均可出發(fā)
axis_pointer_type='cross', # 指示器類型,鼠標(biāo)移動到圖表區(qū)可以查看效果
# formatter = '{a}<br>:{c}人' # 文本內(nèi)容
),
datazoom_opts=opts.DataZoomOpts(
range_start=0, # 開始范圍
range_end=25, # 結(jié)束范圍
# orient='vertical', # 設(shè)置為垂直布局
type_='slider', # slider形式
is_zoom_lock=False, # 鎖定區(qū)域大小
# pos_left='1%' # 設(shè)置位置
),
yaxis_opts=opts.AxisOpts(
is_show=True,
splitline_opts=opts.SplitLineOpts(is_show=False), # 分割線
axistick_opts=opts.AxisTickOpts(is_show=False), # 刻度不顯示
axislabel_opts=opts.LabelOpts( # 坐標(biāo)軸標(biāo)簽配置
font_size=13, # 字體大小
font_weight='bolder' # 字重
),
), # 關(guān)閉Y軸顯示
xaxis_opts=opts.AxisOpts(
boundary_gap=False, # 兩邊不顯示間隔
axistick_opts=opts.AxisTickOpts(is_show=True), # 刻度不顯示
splitline_opts=opts.SplitLineOpts(is_show=False), # 分割線不顯示
axisline_opts=opts.AxisLineOpts(is_show=True), # 軸不顯示
axislabel_opts=opts.LabelOpts( # 坐標(biāo)軸標(biāo)簽配置
font_size=13, # 字體大小
font_weight='bolder' # 字重
),
),
)

# 新建一個折線圖Line
line2 = Line()
line2.add_xaxis(data['日期'].tolist())
# 將line數(shù)據(jù)通過yaxis_index指向后添加的Y軸
# line2.extend_axis(yaxis=opts.AxisOpts())
line2.add_yaxis(
label2,
data['利潤/虧損'].tolist(),
yaxis_index=0,
is_symbol_show=False, # 是否顯示數(shù)據(jù)標(biāo)簽點(diǎn)
is_smooth=True, # 設(shè)置曲線平滑
label_opts=opts.LabelOpts(
is_show=True, # 是否顯示數(shù)據(jù)
),
# 線條粗細(xì)陰影設(shè)置
linestyle_opts={
"normal": {
"color": "#44B2BE", # 線條顏色
"shadowColor": '#44B2BE60', # 陰影顏色和不透明度
"shadowBlur": 8, # 陰影虛化大小
"shadowOffsetY": 20, # 陰影y偏移量
"shadowOffsetX": 20, # 陰影x偏移量
"width": 7 # 線條粗細(xì)
},
},
)
line1.overlap(line2)
tab.add(line1, table)
return tab.render(title + '-' + subtitle + '.html')
echarts_two_line(year_lis, sale_data_lis, title='銷售額、利潤在時間維度的變化', subtitle=' ',
label='銷售額', label2='利潤/虧損')

6、銷售額

sale_sum = int(data['銷售額'].sum())
num_count = int(data['產(chǎn)品數(shù)量'].sum())
profit_sum = int(data['利潤/虧損'].sum())
print(profit_sum)
def big_data(title='主標(biāo)題', subtitle='副標(biāo)題'):
c = Pie(
init_opts=opts.InitOpts(
chart_id=1,
bg_color='#080b30',
theme='dark',
width='300px',
height='300px',
)
)
c.set_global_opts(
title_opts=opts.TitleOpts(
title=title,
subtitle=subtitle,
title_textstyle_opts=opts.TextStyleOpts(
font_size=36,
color='#FFFFFF',
),
pos_left='center',
pos_top='middle'
)
)
return c.render(str(title) + '-' + subtitle + '.html')
big_data(title=sale_sum, subtitle='銷售額')

到此這篇關(guān)于Python pyecharts案例超市4年數(shù)據(jù)可視化分析的文章就介紹到這了,更多相關(guān)pyecharts數(shù)據(jù)可視化內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 一文教會你利用Python程序讀取Excel創(chuàng)建折線圖

    一文教會你利用Python程序讀取Excel創(chuàng)建折線圖

    不同類型的圖表有不同的功能,柱形圖主要用于對比數(shù)據(jù),折線圖主要用于展示數(shù)據(jù)變化的趨勢,散點(diǎn)圖主要用于判斷數(shù)據(jù)的相關(guān)性,下面這篇文章主要給大家介紹了關(guān)于如何通過一文教你利用Python程序讀取Excel創(chuàng)建折線圖的相關(guān)資料,需要的朋友可以參考下
    2022-11-11
  • Python寫一個基于MD5的文件監(jiān)聽程序

    Python寫一個基于MD5的文件監(jiān)聽程序

    這篇文章主要給大家介紹了關(guān)于利用Python如何寫一個基于MD5的文件監(jiān)聽程序的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者使用python具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-03-03
  • import?sklearn報錯正確安裝sklearn的解決方法

    import?sklearn報錯正確安裝sklearn的解決方法

    這篇文章主要介紹了import?sklearn報錯正確安裝sklearn的解決方法,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-04-04
  • 3個用于數(shù)據(jù)科學(xué)的頂級Python庫

    3個用于數(shù)據(jù)科學(xué)的頂級Python庫

    今天小編就為大家分享一篇關(guān)于3個用于數(shù)據(jù)科學(xué)的頂級Python庫,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧
    2018-09-09
  • Python設(shè)計(jì)模式之門面模式簡單示例

    Python設(shè)計(jì)模式之門面模式簡單示例

    這篇文章主要介紹了Python設(shè)計(jì)模式之門面模式,簡單描述了門面模式的概念、原理,并結(jié)合實(shí)例形式給出了Python定義與使用門面模式的具體操作技巧,需要的朋友可以參考下
    2018-01-01
  • Python多線程編程(七):使用Condition實(shí)現(xiàn)復(fù)雜同步

    Python多線程編程(七):使用Condition實(shí)現(xiàn)復(fù)雜同步

    這篇文章主要介紹了Python多線程編程(七):使用Condition實(shí)現(xiàn)復(fù)雜同步,本文講解通過很著名的“生產(chǎn)者-消費(fèi)者”模型來來演示在Python中使用Condition實(shí)現(xiàn)復(fù)雜同步,需要的朋友可以參考下
    2015-04-04
  • Python標(biāo)準(zhǔn)庫06之子進(jìn)程 (subprocess包) 詳解

    Python標(biāo)準(zhǔn)庫06之子進(jìn)程 (subprocess包) 詳解

    本篇文章主要介紹了Python標(biāo)準(zhǔn)庫06之子進(jìn)程 (subprocess包) 詳解,具有一定的參考價值,有興趣的同學(xué)可以了解一下。
    2016-12-12
  • opencv 分類白天與夜景視頻的方法

    opencv 分類白天與夜景視頻的方法

    最近有個數(shù)據(jù)需要分類處理,是一批含有白天跟夜晚的視頻數(shù)據(jù),需要進(jìn)行區(qū)分開來,本文就來實(shí)現(xiàn),感興趣的可以了解一下
    2021-06-06
  • 對Python3之進(jìn)程池與回調(diào)函數(shù)的實(shí)例詳解

    對Python3之進(jìn)程池與回調(diào)函數(shù)的實(shí)例詳解

    今天小編就為大家分享一篇對Python3之進(jìn)程池與回調(diào)函數(shù)的實(shí)例詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-01-01
  • Python庫Theano深度神經(jīng)網(wǎng)絡(luò)的設(shè)計(jì)訓(xùn)練深入探究

    Python庫Theano深度神經(jīng)網(wǎng)絡(luò)的設(shè)計(jì)訓(xùn)練深入探究

    Theano是一個用于深度學(xué)習(xí)的Python庫,它提供了高效的數(shù)值計(jì)算和自動微分功能,使得深度神經(jīng)網(wǎng)絡(luò)的設(shè)計(jì)和訓(xùn)練變得更加容易,本文將深入探討Theano的功能和用法,并提供豐富的示例代碼,幫助大家入門深度學(xué)習(xí)
    2024-01-01

最新評論