19-20年月度行业分析

Table of Contents

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import warnings
warnings.filterwarnings("ignore")
import plotly.express as px
import plotly as py
from plotly.offline import iplot
%matplotlib inline

对各一级行业分析

hangye_data=pd.read_excel(r"C:\Users\qingmu_622\Desktop\我的\19-20年月度分析.xlsx",encoding='utf-8')
hangye_data.head()
platformcidindustrycategorythemonth销售额访客客群指数行业简称年月
0天猫50010368ZIPPO/瑞士军刀/眼镜太阳眼镜2020-01-0162484514.136663217110583.28眼镜1月2020年2020年1月
1天猫122444001ZIPPO/瑞士军刀/眼镜品牌打火机及配件2020-01-0176701866.4712410872153290.58眼镜1月2020年2020年1月
2天猫290601ZIPPO/瑞士军刀/眼镜瑞士军刀2020-01-011093623.143791628693.60眼镜1月2020年2020年1月
3天猫50012709ZIPPO/瑞士军刀/眼镜酒具2020-01-01566046.55775198419.74眼镜1月2020年2020年1月
4天猫2909ZIPPO/瑞士军刀/眼镜烟具2020-01-0115652930.86255666971458.01眼镜1月2020年2020年1月
hangye_data['客群指数']=round(hangye_data['客群指数'],0).astype(int)
hangye_data["uv价值"]=hangye_data['销售额']/hangye_data['访客']
hangye_data["客单价"]=hangye_data['销售额']/hangye_data['客群指数']
hangye_data['支付转化率%']=round(hangye_data["客群指数"]/hangye_data["访客"]*100,2)
# hangye_data['支付转化率%']=hangye_data["支付转化率"].apply(lambda x:"%.2f%%" % (x*100))
hangye_data.head()
platformcidindustrycategorythemonth销售额访客客群指数行业简称年月uv价值客单价支付转化率%
0天猫50010368ZIPPO/瑞士军刀/眼镜太阳眼镜2020-01-0162484514.136663217110583眼镜1月2020年2020年1月9.377530565.0462921.66
1天猫122444001ZIPPO/瑞士军刀/眼镜品牌打火机及配件2020-01-0176701866.4712410872153291眼镜1月2020年2020年1月6.180216500.3677091.24
2天猫290601ZIPPO/瑞士军刀/眼镜瑞士军刀2020-01-011093623.143791628694眼镜1月2020年2020年1月2.884316125.7905612.29
3天猫50012709ZIPPO/瑞士军刀/眼镜酒具2020-01-01566046.55775198420眼镜1月2020年2020年1月7.30203667.22643110.86
4天猫2909ZIPPO/瑞士军刀/眼镜烟具2020-01-0115652930.86255666971458眼镜1月2020年2020年1月6.122392219.0507832.79
hangye_data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2762 entries, 0 to 2761
Data columns (total 15 columns):
platform    2762 non-null object
cid         2762 non-null int64
industry    2762 non-null object
category    2762 non-null object
themonth    2762 non-null datetime64[ns]
销售额         2762 non-null float64
访客          2762 non-null int64
客群指数        2762 non-null int32
行业简称        2762 non-null object
月           2762 non-null object
年           2762 non-null object
年月          2762 non-null object
uv价值        2743 non-null float64
客单价         2740 non-null float64
支付转化率%      2743 non-null float64
dtypes: datetime64[ns](1), float64(4), int32(1), int64(2), object(7)
memory usage: 313.0+ KB
hangye_data.describe()
cid销售额访客客群指数uv价值客单价支付转化率%
count2.762000e+032.762000e+032.762000e+032.762000e+032743.0000002740.0000002743.00
mean7.880241e+071.943388e+081.761449e+071.549741e+05infinfinf
std4.950330e+073.758401e+082.521706e+071.550091e+05NaNNaNNaN
min1.622000e+030.000000e+000.000000e+000.000000e+000.0000005.8958490.00
25%5.001113e+071.002853e+072.184107e+063.902300e+043.953178209.6071190.80
50%5.001320e+075.073543e+077.790471e+061.030285e+056.837966504.0543291.40
75%1.214120e+082.049130e+082.162032e+072.328680e+0511.6096121072.0986082.37
max2.013131e+084.828030e+091.701662e+081.002780e+06infinfinf
sales_cut=pd.cut(hangye_data["销售额"],bins=10,right=False)
bin_sales=pd.DataFrame(sales_cut.value_counts(sort=False))
bin_sales
销售额
[0.0, 482803020.99)2455
[482803020.99, 965606041.98)178
[965606041.98, 1448409062.97)78
[1448409062.97, 1931212083.96)26
[1931212083.96, 2414015104.95)14
[2414015104.95, 2896818125.94)6
[2896818125.94, 3379621146.93)2
[3379621146.93, 3862424167.92)1
[3862424167.92, 4345227188.91)0
[4345227188.91, 4832858240.11)2
bin_sales.rename(columns={"销售额":"频数"},inplace=True)
bin_sales["频率"]=bin_sales["频数"]/bin_sales["频数"].sum()
bin_sales["累计频率"]=bin_sales["频率"].cumsum()
# bin_sales['频率%']=round(bin_sales["频率"]*100,2)
bin_sales['频率%'] = bin_sales['频率'].apply(lambda x: "%.2f%%" % (x*100))  
bin_sales.style.bar(["频率","累计频率"],color="skyblue",width=100)
            <tr>
                    <th id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0flevel0_row0" class="row_heading level0 row0" >[0.0, 482803020.99)</th>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow0_col0" class="data row0 col0" >2455</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow0_col1" class="data row0 col1" >0.888849</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow0_col2" class="data row0 col2" >0.888849</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow0_col3" class="data row0 col3" >88.88%</td>
        </tr>
        <tr>
                    <th id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0flevel0_row1" class="row_heading level0 row1" >[482803020.99, 965606041.98)</th>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow1_col0" class="data row1 col0" >178</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow1_col1" class="data row1 col1" >0.0644461</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow1_col2" class="data row1 col2" >0.953295</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow1_col3" class="data row1 col3" >6.44%</td>
        </tr>
        <tr>
                    <th id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0flevel0_row2" class="row_heading level0 row2" >[965606041.98, 1448409062.97)</th>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow2_col0" class="data row2 col0" >78</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow2_col1" class="data row2 col1" >0.0282404</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow2_col2" class="data row2 col2" >0.981535</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow2_col3" class="data row2 col3" >2.82%</td>
        </tr>
        <tr>
                    <th id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0flevel0_row3" class="row_heading level0 row3" >[1448409062.97, 1931212083.96)</th>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow3_col0" class="data row3 col0" >26</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow3_col1" class="data row3 col1" >0.00941347</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow3_col2" class="data row3 col2" >0.990949</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow3_col3" class="data row3 col3" >0.94%</td>
        </tr>
        <tr>
                    <th id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0flevel0_row4" class="row_heading level0 row4" >[1931212083.96, 2414015104.95)</th>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow4_col0" class="data row4 col0" >14</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow4_col1" class="data row4 col1" >0.00506879</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow4_col2" class="data row4 col2" >0.996017</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow4_col3" class="data row4 col3" >0.51%</td>
        </tr>
        <tr>
                    <th id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0flevel0_row5" class="row_heading level0 row5" >[2414015104.95, 2896818125.94)</th>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow5_col0" class="data row5 col0" >6</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow5_col1" class="data row5 col1" >0.00217234</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow5_col2" class="data row5 col2" >0.99819</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow5_col3" class="data row5 col3" >0.22%</td>
        </tr>
        <tr>
                    <th id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0flevel0_row6" class="row_heading level0 row6" >[2896818125.94, 3379621146.93)</th>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow6_col0" class="data row6 col0" >2</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow6_col1" class="data row6 col1" >0.000724113</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow6_col2" class="data row6 col2" >0.998914</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow6_col3" class="data row6 col3" >0.07%</td>
        </tr>
        <tr>
                    <th id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0flevel0_row7" class="row_heading level0 row7" >[3379621146.93, 3862424167.92)</th>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow7_col0" class="data row7 col0" >1</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow7_col1" class="data row7 col1" >0.000362056</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow7_col2" class="data row7 col2" >0.999276</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow7_col3" class="data row7 col3" >0.04%</td>
        </tr>
        <tr>
                    <th id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0flevel0_row8" class="row_heading level0 row8" >[3862424167.92, 4345227188.91)</th>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow8_col0" class="data row8 col0" >0</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow8_col1" class="data row8 col1" >0</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow8_col2" class="data row8 col2" >0.999276</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow8_col3" class="data row8 col3" >0.00%</td>
        </tr>
        <tr>
                    <th id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0flevel0_row9" class="row_heading level0 row9" >[4345227188.91, 4832858240.11)</th>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow9_col0" class="data row9 col0" >2</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow9_col1" class="data row9 col1" >0.000724113</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow9_col2" class="data row9 col2" >1</td>
                    <td id="T_4ffd1e06_d233_11ea_8b01_48a472e0af0frow9_col3" class="data row9 col3" >0.07%</td>
        </tr>
</tbody></table>
频数频率累计频率频率%
# hangye_data['客单价']=hangye_data["客单价"].fillna(hangye_data["客单价"].mean())
# hangye_data.isnull().sum()
plt.rcParams['font.sans-serif']=['SimHei']
hangye_data=hangye_data[hangye_data['行业简称']!='床上用品']
group_danjia=hangye_data.groupby("行业简称").mean()
plt.figure(figsize=(10,5))
group_danjia['uv价值'].plot.area(alpha = 0.5,grid=True)
group_danjia['uv价值'].plot(c="orange")
# plt.grid(ls="--")
plt.xticks(rotation=45,fontsize=13)
plt.xlabel("行业类目",fontsize=15)
plt.ylabel("uv价值(元)",fontsize=15)
plt.yticks(fontsize=13)
(array([ 0.,  2.,  4.,  6.,  8., 10., 12., 14., 16.]),
 <a list of 9 Text yticklabel objects>)

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-HOVHBbG1-1597195737513)(output_11_1.png)]


plt.rcParams['font.sans-serif']=['SimHei']
# hangye_data=hangye_data[hangye_data['行业简称']!='床上用品']
group_danjia1=hangye_data.groupby("月").mean()
plt.figure(figsize=(8,6))
group_danjia1['uv价值'].plot.bar(color = 'skyblue',alpha = 0.8,figsize=(8,3),grid=True)
# group_danjia1['uv价值'].plot(c="deeppink")
for x,y in enumerate(group_danjia1['uv价值']):
    plt.text(x,y+0.3, "%s元" % round(y,1),ha="center",fontsize=10)
plt.grid(ls="--",c="skyblue")
plt.xticks(fontsize=13)
plt.xlabel("月份",fontsize=15)
plt.ylabel("uv价值(元)",fontsize=15)
plt.yticks(fontsize=13)
(array([ 0.,  2.,  4.,  6.,  8., 10., 12.]),
 <a list of 7 Text yticklabel objects>)

[外链图片转存失败,在这里插入图片描述
源站可能有防盗在这里插入图片描述
链机制,建议将图片保存下来直接上传(img-XwORsl5c-1597195737516)(output_13_1.png)]

group_danjia['uv价值']
行业简称
女装       7.130471
女鞋       5.801102
尿片洗护    13.727018
手表      10.118119
男装      10.943612
男鞋       8.579198
眼镜       9.520698
童装       6.674772
童鞋       4.436967
箱包       6.676500
美容护肤    11.908728
运动鞋      8.251129
饰品       5.181402
Name: uv价值, dtype: float64
data_19=hangye_data[hangye_data["年"]=='2019年']
data_20=hangye_data[hangye_data['年']=='2020年']
data_19.shape
(1256, 15)
data_20.shape
(1202, 15)
group_19=data_19.groupby("月").sum()
group_20=data_20.groupby("月").sum()
group_19['销售额']=round(group_19["销售额"])
group_20['销售额']=round(group_20["销售额"])
group_19.head()
cid销售额访客客群指数uv价值客单价支付转化率%
1月155953919074.818361e+103755987467326530052044.785769inf454.80
2月155953919072.317487e+102952157746241622661484.188028inf431.71
3月155953919074.517711e+103968253714354129081932.3546851.767984e+05415.21
4月155953919074.097620e+103965333897349755191702.4058291.568339e+05393.03
5月157966049094.282773e+104068359369358236081672.1305101.573439e+05370.35
import plotly.graph_objects as go
months=["一月","二月","三月","四月","五月","六月"]
fig=go.Figure(data=[
    go.Bar(name='2019年',x=months,y=group_19.iloc[:,1],text=group_19.iloc[:,1],textposition="outside",marker_color='midnightblue'),
    go.Bar(name="2020年",x=months,y=group_20.iloc[:,1],text=group_20.iloc[:,1],marker_color='skyblue'
           , hovertext=['', '', '',"","","六月达到最高"],textposition="outside")
])
fig.update_traces(marker_line_color="black"
                 ,marker_line_width=1.2,opacity=0.9)
fig.update_layout(xaxis_tickangle=25,
     bargap=0.25,title_text="19-20年不同月份下销售额"
    ,uniformtext_minsize=8, xaxis_tickfont_size=17
    ,bargroupgap=0.015
    ,yaxis=dict( title='销售金额', titlefont_size=18, tickfont_size=16)
    ,xaxis=dict( title='月份', titlefont_size=18, tickfont_size=16),template="plotly_dark"
)
fig.show()
        <div id="94ac22c4-78fc-4720-bad7-9a450b8c8c43" class="plotly-graph-div" style="height:525px; width:100%;"></div>
        <script type="text/javascript">
            require(["plotly"], function(Plotly) {
                window.PLOTLYENV=window.PLOTLYENV || {};
                
            if (document.getElementById("94ac22c4-78fc-4720-bad7-9a450b8c8c43")) {
                Plotly.newPlot(
                    '94ac22c4-78fc-4720-bad7-9a450b8c8c43',
                    [{"marker": {"color": "midnightblue", "line": {"color": "black", "width": 1.2}}, "name": "2019\u5e74", "opacity": 0.9, "text": [48183607136.0, 23174873260.0, 45177107966.0, 40976201875.0, 42827731612.0, 53163083776.0], "textposition": "outside", "type": "bar", "x": ["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708"], "y": [48183607136.0, 23174873260.0, 45177107966.0, 40976201875.0, 42827731612.0, 53163083776.0]}, {"hovertext": ["", "", "", "", "", "\u516d\u6708\u8fbe\u5230\u6700\u9ad8"], "marker": {"color": "skyblue", "line": {"color": "black", "width": 1.2}}, "name": "2020\u5e74", "opacity": 0.9, "text": [41260788011.0, 20407848457.0, 44966949091.0, 40610223743.0, 48298933267.0, 62465685382.0], "textposition": "outside", "type": "bar", "x": ["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708"], "y": [41260788011.0, 20407848457.0, 44966949091.0, 40610223743.0, 48298933267.0, 62465685382.0]}],
                    {"bargap": 0.25, "bargroupgap": 0.015, "template": {"data": {"bar": [{"error_x": {"color": "#f2f5fa"}, "error_y": {"color": "#f2f5fa"}, "marker": {"line": {"color": "rgb(17,17,17)", "width": 0.5}}, "type": "bar"}], "barpolar": [{"marker": {"line": {"color": "rgb(17,17,17)", "width": 0.5}}, "type": "barpolar"}], "carpet": [{"aaxis": {"endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6"}, "baxis": {"endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6"}, "type": "carpet"}], "choropleth": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "choropleth"}], "contour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "contour"}], "contourcarpet": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "contourcarpet"}], "heatmap": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmap"}], "heatmapgl": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmapgl"}], "histogram": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "histogram"}], "histogram2d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2d"}], "histogram2dcontour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2dcontour"}], "mesh3d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "mesh3d"}], "parcoords": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "parcoords"}], "pie": [{"automargin": true, "type": "pie"}], "scatter": [{"marker": {"line": {"color": "#283442"}}, "type": "scatter"}], "scatter3d": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatter3d"}], "scattercarpet": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattercarpet"}], "scattergeo": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattergeo"}], "scattergl": [{"marker": {"line": {"color": "#283442"}}, "type": "scattergl"}], "scattermapbox": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattermapbox"}], "scatterpolar": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolar"}], "scatterpolargl": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolargl"}], "scatterternary": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterternary"}], "surface": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "surface"}], "table": [{"cells": {"fill": {"color": "#506784"}, "line": {"color": "rgb(17,17,17)"}}, "header": {"fill": {"color": "#2a3f5f"}, "line": {"color": "rgb(17,17,17)"}}, "type": "table"}]}, "layout": {"annotationdefaults": {"arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1}, "coloraxis": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "colorscale": {"diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]], "sequential": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "sequentialminus": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]]}, "colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52"], "font": {"color": "#f2f5fa"}, "geo": {"bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784"}, "hoverlabel": {"align": "left"}, "hovermode": "closest", "mapbox": {"style": "dark"}, "paper_bgcolor": "rgb(17,17,17)", "plot_bgcolor": "rgb(17,17,17)", "polar": {"angularaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "bgcolor": "rgb(17,17,17)", "radialaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}}, "scene": {"xaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3"}, "yaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3"}, "zaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3"}}, "shapedefaults": {"line": {"color": "#f2f5fa"}}, "sliderdefaults": {"bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0}, "ternary": {"aaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "baxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "bgcolor": "rgb(17,17,17)", "caxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}}, "title": {"x": 0.05}, "updatemenudefaults": {"bgcolor": "#506784", "borderwidth": 0}, "xaxis": {"automargin": true, "gridcolor": "#283442", "linecolor": "#506784", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "#283442", "zerolinewidth": 2}, "yaxis": {"automargin": true, "gridcolor": "#283442", "linecolor": "#506784", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "#283442", "zerolinewidth": 2}}}, "title": {"text": "19-20\u5e74\u4e0d\u540c\u6708\u4efd\u4e0b\u9500\u552e\u989d"}, "uniformtext": {"minsize": 8}, "xaxis": {"tickangle": 25, "tickfont": {"size": 16}, "title": {"font": {"size": 18}, "text": "\u6708\u4efd"}}, "yaxis": {"tickfont": {"size": 16}, "title": {"font": {"size": 18}, "text": "\u9500\u552e\u91d1\u989d"}}},
                    {"responsive": true}
                ).then(function(){

var gd = document.getElementById(‘94ac22c4-78fc-4720-bad7-9a450b8c8c43’);
var x = new MutationObserver(function (mutations, observer) {{
var display = window.getComputedStyle(gd).display;
if (!display || display === ‘none’) {{
console.log([gd, ‘removed!’]);
Plotly.purge(gd);
observer.disconnect();
}}
}});

// Listen for the removal of the full notebook cells
var notebookContainer = gd.closest(’#notebook-container’);
if (notebookContainer) {{
x.observe(notebookContainer, {childList: true});
}}

// Listen for the clearing of the current output cell
var outputEl = gd.closest(’.output’);
if (outputEl) {{
x.observe(outputEl, {childList: true});
}}

                    })
            };
            });
        </script>
    </div>
group_rate19=pd.DataFrame(data_19.groupby("月")["支付转化率%"].mean().apply(lambda x:"%.2f%%" % x))
group_rate20=pd.DataFrame(data_20.groupby("月")["支付转化率%"].mean().apply(lambda x:"%.2f%%" % x))
import plotly.graph_objects as go
months=["一月","二月","三月","四月","五月","六月"]
fig=go.Figure(data=[
    go.Bar(name='2019年',x=months,y=group_rate19.iloc[:,0],text=group_rate19.iloc[:,0]
           ,hovertext=['最高为2.19%', '', '',"","",""],textposition="outside",marker_color='mediumorchid'),
    go.Bar(name="2020年",x=months,y=group_rate20.iloc[:,0],text=group_rate20.iloc[:,0],marker_color='navy'
           , textposition="outside")
])
fig.update_traces(marker_line_color="black"
                 ,marker_line_width=1.2,opacity=0.9)
fig.update_layout(
#     xaxis_tickangle=25,
     bargap=0.25,title_text="19-20年不同月份下的支付转化率"
    ,uniformtext_minsize=8, xaxis_tickfont_size=17
    ,bargroupgap=0.015
    ,yaxis=dict( title='支付转化率', titlefont_size=20, tickfont_size=16)
    ,xaxis=dict( title='月份', titlefont_size=20, tickfont_size=18),template='plotly_white'
)
fig.show()
        <div id="32ad3cfd-44ce-4838-b91e-391eb169da78" class="plotly-graph-div" style="height:525px; width:100%;"></div>
        <script type="text/javascript">
            require(["plotly"], function(Plotly) {
                window.PLOTLYENV=window.PLOTLYENV || {};
                
            if (document.getElementById("32ad3cfd-44ce-4838-b91e-391eb169da78")) {
                Plotly.newPlot(
                    '32ad3cfd-44ce-4838-b91e-391eb169da78',
                    [{"hovertext": ["\u6700\u9ad8\u4e3a2.19%", "", "", "", "", ""], "marker": {"color": "mediumorchid", "line": {"color": "black", "width": 1.2}}, "name": "2019\u5e74", "opacity": 0.9, "text": ["2.19%", "2.08%", "2.00%", "1.89%", "1.77%", "1.96%"], "textposition": "outside", "type": "bar", "x": ["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708"], "y": ["2.19%", "2.08%", "2.00%", "1.89%", "1.77%", "1.96%"]}, {"marker": {"color": "navy", "line": {"color": "black", "width": 1.2}}, "name": "2020\u5e74", "opacity": 0.9, "text": ["1.94%", "1.67%", "1.90%", "1.96%", "1.71%", "1.88%"], "textposition": "outside", "type": "bar", "x": ["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708"], "y": ["1.94%", "1.67%", "1.90%", "1.96%", "1.71%", "1.88%"]}],
                    {"bargap": 0.25, "bargroupgap": 0.015, "template": {"data": {"bar": [{"error_x": {"color": "#2a3f5f"}, "error_y": {"color": "#2a3f5f"}, "marker": {"line": {"color": "white", "width": 0.5}}, "type": "bar"}], "barpolar": [{"marker": {"line": {"color": "white", "width": 0.5}}, "type": "barpolar"}], "carpet": [{"aaxis": {"endlinecolor": "#2a3f5f", "gridcolor": "#C8D4E3", "linecolor": "#C8D4E3", "minorgridcolor": "#C8D4E3", "startlinecolor": "#2a3f5f"}, "baxis": {"endlinecolor": "#2a3f5f", "gridcolor": "#C8D4E3", "linecolor": "#C8D4E3", "minorgridcolor": "#C8D4E3", "startlinecolor": "#2a3f5f"}, "type": "carpet"}], "choropleth": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "choropleth"}], "contour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "contour"}], "contourcarpet": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "contourcarpet"}], "heatmap": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmap"}], "heatmapgl": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmapgl"}], "histogram": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "histogram"}], "histogram2d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2d"}], "histogram2dcontour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2dcontour"}], "mesh3d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "mesh3d"}], "parcoords": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "parcoords"}], "pie": [{"automargin": true, "type": "pie"}], "scatter": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatter"}], "scatter3d": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatter3d"}], "scattercarpet": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattercarpet"}], "scattergeo": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattergeo"}], "scattergl": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattergl"}], "scattermapbox": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattermapbox"}], "scatterpolar": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolar"}], "scatterpolargl": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolargl"}], "scatterternary": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterternary"}], "surface": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "surface"}], "table": [{"cells": {"fill": {"color": "#EBF0F8"}, "line": {"color": "white"}}, "header": {"fill": {"color": "#C8D4E3"}, "line": {"color": "white"}}, "type": "table"}]}, "layout": {"annotationdefaults": {"arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1}, "coloraxis": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "colorscale": {"diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]], "sequential": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "sequentialminus": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]]}, "colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52"], "font": {"color": "#2a3f5f"}, "geo": {"bgcolor": "white", "lakecolor": "white", "landcolor": "white", "showlakes": true, "showland": true, "subunitcolor": "#C8D4E3"}, "hoverlabel": {"align": "left"}, "hovermode": "closest", "mapbox": {"style": "light"}, "paper_bgcolor": "white", "plot_bgcolor": "white", "polar": {"angularaxis": {"gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": ""}, "bgcolor": "white", "radialaxis": {"gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": ""}}, "scene": {"xaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "gridwidth": 2, "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8"}, "yaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "gridwidth": 2, "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8"}, "zaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "gridwidth": 2, "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8"}}, "shapedefaults": {"line": {"color": "#2a3f5f"}}, "ternary": {"aaxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": ""}, "baxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": ""}, "bgcolor": "white", "caxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": ""}}, "title": {"x": 0.05}, "xaxis": {"automargin": true, "gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "#EBF0F8", "zerolinewidth": 2}, "yaxis": {"automargin": true, "gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "#EBF0F8", "zerolinewidth": 2}}}, "title": {"text": "19-20\u5e74\u4e0d\u540c\u6708\u4efd\u4e0b\u7684\u652f\u4ed8\u8f6c\u5316\u7387"}, "uniformtext": {"minsize": 8}, "xaxis": {"tickfont": {"size": 18}, "title": {"font": {"size": 20}, "text": "\u6708\u4efd"}}, "yaxis": {"tickfont": {"size": 16}, "title": {"font": {"size": 20}, "text": "\u652f\u4ed8\u8f6c\u5316\u7387"}}},
                    {"responsive": true}
                ).then(function(){

var gd = document.getElementById(‘32ad3cfd-44ce-4838-b91e-391eb169da78’);
var x = new MutationObserver(function (mutations, observer) {{
var display = window.getComputedStyle(gd).display;
if (!display || display === ‘none’) {{
console.log([gd, ‘removed!’]);
Plotly.purge(gd);
observer.disconnect();
}}
}});

// Listen for the removal of the full notebook cells
var notebookContainer = gd.closest(’#notebook-container’);
if (notebookContainer) {{
x.observe(notebookContainer, {childList: true});
}}

// Listen for the clearing of the current output cell
var outputEl = gd.closest(’.output’);
if (outputEl) {{
x.observe(outputEl, {childList: true});
}}

                    })
            };
            });
        </script>
    </div>
group_rate=(group_20['销售额']/group_19['销售额']-1)*100
group_rate
月
1月   -14.367582
2月   -11.939762
3月    -0.465189
4月    -0.893148
5月    12.774904
6月    17.498236
Name: 销售额, dtype: float64
import matplotlib
import numpy as np
matplotlib.rcParams["font.sans-serif"]=["SimHei"]
matplotlib.rcParams['axes.unicode_minus']=False
fig = plt.figure(figsize=(9,6))
plt.grid(ls="--")
ax1 = fig.add_subplot(111)

size = 6
x = np.arange(size)
total_width, n = 0.8, 2
width = total_width / n
x = x - (total_width - width) / 2

# ax1.plot(group_19['销售额'],label="19年",marker="*")
ax1.bar(x,height=group_19['销售额'],width=width,color="thistle",label="19年")
# ax1.plot(group_20['销售额'],label="20年",marker=".")
ax1.bar(x+width,height=group_20['销售额'],width=width,color="skyblue",label="20年")
ax1.set_ylabel("销售额(百亿)",fontsize=16,labelpad=12)
ax1.set_title("19-20年不同月份下销售额及增长率",fontsize='18',pad=20)
ax1.set_xlabel("月份",fontsize=15,labelpad=12)
ax1.legend(bbox_to_anchor=(0.14,1))
# for x,y in enumerate(group_19['销售额']):
#     plt.text(x,y+0.3, "%s元" % round(y,1),ha="right",fontsize=10)
# for x,y in enumerate(group_20['销售额']):
#     plt.text(x,y+0.3, "%s元" % round(y,1),ha="left",fontsize=10)
plt.yticks(fontsize=15)
plt.xticks(fontsize=15)
    
ax2 = ax1.twinx()  # 这个很重要噢
ax2.plot(group_rate ,marker='o',ms=10,c="coral",label="同比增长率")
ax2.set_ylabel("同比增长率(%)",fontsize=15)
ax2.set_ylim([-20,20])
plt.axhline(0,color='royalblue',linestyle="--",alpha=0.8)
ax2.legend(bbox_to_anchor=(0.2,0.88))
for x,y in enumerate(group_rate):
     plt.text(x,y+0.3, "%s%%" % round(y,1),ha="right",fontsize=12)

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-okZRbgsl-1597195737518)(output_22在这里插入图片描述
_0.png)]

group_rate1=(group_20['访客']/group_19['访客']-1)*100
group_rate1
月
1月    4.330794
2月    6.017685
3月    5.682588
4月    3.946420
5月    9.947627
6月    4.402785
Name: 访客, dtype: float64
import matplotlib
import numpy as np
matplotlib.rcParams["font.sans-serif"]=["SimHei"]
matplotlib.rcParams['axes.unicode_minus']=False
fig = plt.figure(figsize=(9,6))
plt.grid(ls="--")
ax1 = fig.add_subplot(111)

size = 6
x = np.arange(size)
total_width, n = 0.8, 2
width = total_width / n
x = x - (total_width - width) / 2

# ax1.plot(group_19['销售额'],label="19年",marker="*")
ax1.bar(x,height=group_19['访客'],width=width,color="orange",label="19年")
# ax1.plot(group_20['销售额'],label="20年",marker=".")
ax1.bar(x+width,height=group_20['访客'],width=width,color="royalblue",label="20年")
ax1.set_ylabel("访客数(十亿)",fontsize=16,labelpad=12)
ax1.set_title("19-20年不同月份下访客数变化及增长率",fontsize='18',pad=20)
ax1.set_xlabel("月份",fontsize=15,labelpad=12)
ax1.legend(bbox_to_anchor=(0.14,1))
plt.yticks(fontsize=15)
plt.xticks(fontsize=15)
# x1=['一月','二月',"三月","四月","五月","六月"]
# y1=['-14.419152',"-12.285846","0.087202","0.078587","13.977355","16.454565"]
# for a, b in zip(x1, y1):
#    ax2.text(a, b, b, ha='center', va='bottom', fontsize=20)
    
ax2 = ax1.twinx()  # 这个很重要噢
ax2.plot(group_rate1 ,marker='>',ms=10,c="red",label="同比增长率")
ax2.set_ylabel("同比增长率(%)",fontsize=15)
ax2.set_ylim([0,15])

# ax2.text(x=group_rate.index.tolist(),y=group_rate.values,s=group_rate.values, ha='center', va='bottom', fontsize=20)

ax2.legend(bbox_to_anchor=(0.32,1))
<matplotlib.legend.Legend at 0x158b245ef98>

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-5eBZR7Ae-1597195737520)在这里插入图片描述
(out在这里插入图片描述
put_24_1.png)]

group_20['访客']
月
1月    3918651529
2月    3129809290
3月    4193753215
4月    4121822644
5月    4473064598
6月    4224718219
Name: 访客, dtype: int64
group_hyjc19=data_19.groupby("行业简称").sum()
group_hyjc19['销售额']=round(group_hyjc19['销售额'])
group_hyjc19.head()
cid销售额访客客群指数uv价值客单价支付转化率%
行业简称
女装62618063107.945264e+108515147650408918001188.732764251402.38700085.81
女鞋57309504601.489313e+10169196446010723067244.70601638735.56286736.49
尿片洗护56725825381.156226e+10770647908187556801442.52180460873.130001316.94
手表59182143224.110140e+093147362712859762452.71757966330.304151109.93
男装67497887344.361552e+102513063012239275091530.280202144268.177525188.74
group_hyjc20=data_20.groupby("行业简称").sum()
group_hyjc20['销售额']=round(group_hyjc20['销售额'])
group_hyjc20.head()
cid销售额访客客群指数uv价值客单价支付转化率%
行业简称
女装86767373947.745710e+109127249618408208601121.539841244815.52463087.06
女鞋57309504601.501561e+10169425136410201200242.58651640610.24385032.75
尿片洗护56224345351.363614e+10993655266209796551330.33581763129.196749263.61
手表67230663304.550953e+093570187672659916599.56682883288.730439201.10
男装77563012793.749852e+102385366692224026361413.551486133944.571198194.04
# fig,(ax1,ax2)=plt.subplots(1,2,figsize=(12,4))
# plt.subplot(121)
# plt.grid()
# plt.scatter(group_hyjc19["访客"],group_hyjc19["销售额"],s=group_hyjc19["销售额"]/150000000
#             ,alpha = 0.4, cmap = 'jet',c=group_hyjc19['访客'])
# # plt.ylim([0,7])
# plt.subplot(122)
# plt.grid()
# plt.scatter(group_hyjc19["访客"],group_hyjc19["销售额"],s=group_hyjc19["销售额"]/170000000
#             ,alpha = 0.4, cmap = 'cool',c=group_hyjc19['访客'])
plt.figure(figsize=(9,7))
plt.grid(".")
for  title,i in zip(["19年","20年"],[group_hyjc19,group_hyjc20]):
        plt.scatter(i["访客"],i["销售额"],s=i["销售额"]/100000000
            ,alpha = 0.5, cmap = i,label=title,linewidths=0.9,edgecolors="skyblue") 
plt.legend()
<matplotlib.legend.Legend at 0![!\[](https://img-blog.csdnimg.cn/20200812093508632.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2d1dWloa24=,size_16,color_FFFFFF,t_70#pic_center)

在这里插入图片描述](https://img-blog.csdnimg.cn/20200812093457824.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2d1dWloa24=,size_16,color_FFFFFF,t_70#pic_center)
x158b2602f28>

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4DQNSvRF-1597195737521)(output_29_1.png)]

import plotly.graph_objects as go
fig=go.Figure(data=[
    go.Bar(name='2019年',x=group_hyjc20.index.tolist(),y=group_hyjc19.iloc[:,1],hovertext=["女装遥遥领先"]
           ,text=group_hyjc19.iloc[:,1],textposition="inside",marker_color='seagreen'),
    go.Bar(name="2020年",x=group_hyjc20.index.tolist(),y=group_hyjc20.iloc[:,1]
           ,text=group_hyjc20.iloc[:,1],marker_color='skyblue', hovertext=['女装遥遥领先', '', '',"","",""],textposition="inside")
])
fig.update_traces(marker_line_color="black"
                 ,marker_line_width=1.2,opacity=0.9)
fig.update_layout(xaxis_tickangle=50,
     bargap=0.25,title_text="19-20年前半年的不同行业的销售总额"
    ,uniformtext_minsize=8, xaxis_tickfont_size=17
    ,bargroupgap=0.03
    ,yaxis=dict( title='销售金额', titlefont_size=18, tickfont_size=16)
    ,xaxis=dict( title='行业类目', titlefont_size=18, tickfont_size=16)
)
fig.show()
        <div id="402d007f-5e16-4bbc-b76a-146b640ea62c" class="plotly-graph-div" style="height:525px; width:100%;"></div>
        <script type="text/javascript">
            require(["plotly"], function(Plotly) {
                window.PLOTLYENV=window.PLOTLYENV || {};
                
            if (document.getElementById("402d007f-5e16-4bbc-b76a-146b640ea62c")) {
                Plotly.newPlot(
                    '402d007f-5e16-4bbc-b76a-146b640ea62c',
                    [{"hovertext": ["\u5973\u88c5\u9065\u9065\u9886\u5148"], "marker": {"color": "seagreen", "line": {"color": "black", "width": 1.2}}, "name": "2019\u5e74", "opacity": 0.9, "text": [79452642008.0, 14893126630.0, 11562258347.0, 4110139994.0, 43615515942.0, 11071813664.0, 3809851464.0, 17443580327.0, 4796268993.0, 9544811267.0, 33577353044.0, 13852399330.0, 5772844615.0], "textposition": "inside", "type": "bar", "x": ["\u5973\u88c5", "\u5973\u978b", "\u5c3f\u7247\u6d17\u62a4", "\u624b\u8868", "\u7537\u88c5", "\u7537\u978b", "\u773c\u955c", "\u7ae5\u88c5", "\u7ae5\u978b", "\u7bb1\u5305", "\u7f8e\u5bb9\u62a4\u80a4", "\u8fd0\u52a8\u978b", "\u9970\u54c1"], "y": [79452642008.0, 14893126630.0, 11562258347.0, 4110139994.0, 43615515942.0, 11071813664.0, 3809851464.0, 17443580327.0, 4796268993.0, 9544811267.0, 33577353044.0, 13852399330.0, 5772844615.0]}, {"hovertext": ["\u5973\u88c5\u9065\u9065\u9886\u5148", "", "", "", "", ""], "marker": {"color": "skyblue", "line": {"color": "black", "width": 1.2}}, "name": "2020\u5e74", "opacity": 0.9, "text": [77457096041.0, 15015605348.0, 13636142442.0, 4550953223.0, 37498520801.0, 10034843314.0, 438868029.0, 17293683342.0, 2791340549.0, 7691632462.0, 48546266122.0, 16484281636.0, 6571194642.0], "textposition": "inside", "type": "bar", "x": ["\u5973\u88c5", "\u5973\u978b", "\u5c3f\u7247\u6d17\u62a4", "\u624b\u8868", "\u7537\u88c5", "\u7537\u978b", "\u773c\u955c", "\u7ae5\u88c5", "\u7ae5\u978b", "\u7bb1\u5305", "\u7f8e\u5bb9\u62a4\u80a4", "\u8fd0\u52a8\u978b", "\u9970\u54c1"], "y": [77457096041.0, 15015605348.0, 13636142442.0, 4550953223.0, 37498520801.0, 10034843314.0, 438868029.0, 17293683342.0, 2791340549.0, 7691632462.0, 48546266122.0, 16484281636.0, 6571194642.0]}],
                    {"bargap": 0.25, "bargroupgap": 0.03, "template": {"data": {"bar": [{"error_x": {"color": "#2a3f5f"}, "error_y": {"color": "#2a3f5f"}, "marker": {"line": {"color": "#E5ECF6", "width": 0.5}}, "type": "bar"}], "barpolar": [{"marker": {"line": {"color": "#E5ECF6", "width": 0.5}}, "type": "barpolar"}], "carpet": [{"aaxis": {"endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f"}, "baxis": {"endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f"}, "type": "carpet"}], "choropleth": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "choropleth"}], "contour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "contour"}], "contourcarpet": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "contourcarpet"}], "heatmap": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmap"}], "heatmapgl": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmapgl"}], "histogram": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "histogram"}], "histogram2d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2d"}], "histogram2dcontour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2dcontour"}], "mesh3d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "mesh3d"}], "parcoords": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "parcoords"}], "pie": [{"automargin": true, "type": "pie"}], "scatter": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatter"}], "scatter3d": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatter3d"}], "scattercarpet": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattercarpet"}], "scattergeo": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattergeo"}], "scattergl": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattergl"}], "scattermapbox": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattermapbox"}], "scatterpolar": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolar"}], "scatterpolargl": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolargl"}], "scatterternary": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterternary"}], "surface": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "surface"}], "table": [{"cells": {"fill": {"color": "#EBF0F8"}, "line": {"color": "white"}}, "header": {"fill": {"color": "#C8D4E3"}, "line": {"color": "white"}}, "type": "table"}]}, "layout": {"annotationdefaults": {"arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1}, "coloraxis": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "colorscale": {"diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]], "sequential": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "sequentialminus": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]]}, "colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52"], "font": {"color": "#2a3f5f"}, "geo": {"bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white"}, "hoverlabel": {"align": "left"}, "hovermode": "closest", "mapbox": {"style": "light"}, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": {"angularaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "bgcolor": "#E5ECF6", "radialaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}}, "scene": {"xaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white"}, "yaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white"}, "zaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white"}}, "shapedefaults": {"line": {"color": "#2a3f5f"}}, "ternary": {"aaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "baxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "bgcolor": "#E5ECF6", "caxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}}, "title": {"x": 0.05}, "xaxis": {"automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "white", "zerolinewidth": 2}, "yaxis": {"automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "white", "zerolinewidth": 2}}}, "title": {"text": "19-20\u5e74\u524d\u534a\u5e74\u7684\u4e0d\u540c\u884c\u4e1a\u7684\u9500\u552e\u603b\u989d"}, "uniformtext": {"minsize": 8}, "xaxis": {"tickangle": 50, "tickfont": {"size": 16}, "title": {"font": {"size": 18}, "text": "\u884c\u4e1a\u7c7b\u76ee"}}, "yaxis": {"tickfont": {"size": 16}, "title": {"font": {"size": 18}, "text": "\u9500\u552e\u91d1\u989d"}}},
                    {"responsive": true}
                ).then(function(){

var gd = document.getElementById(‘402d007f-5e16-4bbc-b76a-146b640ea62c’);
var x = new MutationObserver(function (mutations, observer) {{
var display = window.getComputedStyle(gd).display;
if (!display || display === ‘none’) {{
console.log([gd, ‘removed!’]);
Plotly.purge(gd);
observer.disconnect();
}}
}});

// Listen for the removal of the full notebook cells
var notebookContainer = gd.closest(’#notebook-container’);
if (notebookContainer) {{
x.observe(notebookContainer, {childList: true});
}}

// Listen for the clearing of the current output cell
var outputEl = gd.closest(’.output’);
if (outputEl) {{
x.observe(outputEl, {childList: true});
}}

                    })
            };
            });
        </script>
    </div>
group_rate_hyjc19=pd.DataFrame(data_19.groupby("行业简称")["支付转化率%"].mean().apply(lambda x : "%.2f%%" % x))
group_rate_hyjc20=pd.DataFrame(data_20.groupby("行业简称")["支付转化率%"].mean().apply(lambda x : "%.2f%%" % x))
group_rate_hyjc19.sort_values(by="支付转化率%",ascending="True").head(5)
支付转化率%
行业简称
女装0.55%
女鞋0.87%
男装1.43%
饰品1.71%
童装1.90%
import plotly.graph_objects as go
fig=go.Figure(data=[
    go.Bar(name="2019年",x=group_rate_hyjc19.index,y=group_rate_hyjc19.iloc[:,0]
           ,text=group_rate_hyjc19.iloc[:,0],textposition="outside"),
    go.Bar(name="2020年",x=group_rate_hyjc20.index,y=group_rate_hyjc20.iloc[:,0]
           ,text=group_rate_hyjc20.iloc[:,0],textposition="outside")
])
fig.update_traces(marker_line_color="pink"
                 ,marker_line_width=1.0,opacity=0.86)
fig.update_layout(xaxis_tickangle=50,
     bargap=0.25,title_text="19-20年前半年月度不同行业支付转化率"
    ,uniformtext_minsize=8, xaxis_tickfont_size=17
    ,bargroupgap=0.03
    ,yaxis=dict( title='销售金额', titlefont_size=15, tickfont_size=17)
    ,xaxis=dict( title='行业类目', titlefont_size=15 ,tickfont_size=17)
    ,template='plotly_dark')
fig.show()
        <div id="2c2777ab-e6f5-4c32-84dd-8023395d8d22" class="plotly-graph-div" style="height:525px; width:100%;"></div>
        <script type="text/javascript">
            require(["plotly"], function(Plotly) {
                window.PLOTLYENV=window.PLOTLYENV || {};
                
            if (document.getElementById("2c2777ab-e6f5-4c32-84dd-8023395d8d22")) {
                Plotly.newPlot(
                    '2c2777ab-e6f5-4c32-84dd-8023395d8d22',
                    [{"marker": {"line": {"color": "pink", "width": 1.0}}, "name": "2019\u5e74", "opacity": 0.86, "text": ["0.55%", "0.87%", "3.11%", "2.20%", "1.43%", "1.91%", "4.48%", "1.90%", "2.34%", "2.23%", "2.28%", "2.04%", "1.71%"], "textposition": "outside", "type": "bar", "x": ["\u5973\u88c5", "\u5973\u978b", "\u5c3f\u7247\u6d17\u62a4", "\u624b\u8868", "\u7537\u88c5", "\u7537\u978b", "\u773c\u955c", "\u7ae5\u88c5", "\u7ae5\u978b", "\u7bb1\u5305", "\u7f8e\u5bb9\u62a4\u80a4", "\u8fd0\u52a8\u978b", "\u9970\u54c1"], "y": ["0.55%", "0.87%", "3.11%", "2.20%", "1.43%", "1.91%", "4.48%", "1.90%", "2.34%", "2.23%", "2.28%", "2.04%", "1.71%"]}, {"marker": {"line": {"color": "pink", "width": 1.0}}, "name": "2020\u5e74", "opacity": 0.86, "text": ["0.52%", "0.78%", "2.64%", "3.72%", "1.42%", "1.59%", "4.68%", "1.72%", "1.93%", "2.11%", "3.27%", "1.50%", "1.46%"], "textposition": "outside", "type": "bar", "x": ["\u5973\u88c5", "\u5973\u978b", "\u5c3f\u7247\u6d17\u62a4", "\u624b\u8868", "\u7537\u88c5", "\u7537\u978b", "\u773c\u955c", "\u7ae5\u88c5", "\u7ae5\u978b", "\u7bb1\u5305", "\u7f8e\u5bb9\u62a4\u80a4", "\u8fd0\u52a8\u978b", "\u9970\u54c1"], "y": ["0.52%", "0.78%", "2.64%", "3.72%", "1.42%", "1.59%", "4.68%", "1.72%", "1.93%", "2.11%", "3.27%", "1.50%", "1.46%"]}],
                    {"bargap": 0.25, "bargroupgap": 0.03, "template": {"data": {"bar": [{"error_x": {"color": "#f2f5fa"}, "error_y": {"color": "#f2f5fa"}, "marker": {"line": {"color": "rgb(17,17,17)", "width": 0.5}}, "type": "bar"}], "barpolar": [{"marker": {"line": {"color": "rgb(17,17,17)", "width": 0.5}}, "type": "barpolar"}], "carpet": [{"aaxis": {"endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6"}, "baxis": {"endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6"}, "type": "carpet"}], "choropleth": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "choropleth"}], "contour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "contour"}], "contourcarpet": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "contourcarpet"}], "heatmap": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmap"}], "heatmapgl": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmapgl"}], "histogram": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "histogram"}], "histogram2d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2d"}], "histogram2dcontour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2dcontour"}], "mesh3d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "mesh3d"}], "parcoords": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "parcoords"}], "pie": [{"automargin": true, "type": "pie"}], "scatter": [{"marker": {"line": {"color": "#283442"}}, "type": "scatter"}], "scatter3d": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatter3d"}], "scattercarpet": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattercarpet"}], "scattergeo": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattergeo"}], "scattergl": [{"marker": {"line": {"color": "#283442"}}, "type": "scattergl"}], "scattermapbox": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattermapbox"}], "scatterpolar": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolar"}], "scatterpolargl": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolargl"}], "scatterternary": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterternary"}], "surface": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "surface"}], "table": [{"cells": {"fill": {"color": "#506784"}, "line": {"color": "rgb(17,17,17)"}}, "header": {"fill": {"color": "#2a3f5f"}, "line": {"color": "rgb(17,17,17)"}}, "type": "table"}]}, "layout": {"annotationdefaults": {"arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1}, "coloraxis": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "colorscale": {"diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]], "sequential": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "sequentialminus": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]]}, "colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52"], "font": {"color": "#f2f5fa"}, "geo": {"bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784"}, "hoverlabel": {"align": "left"}, "hovermode": "closest", "mapbox": {"style": "dark"}, "paper_bgcolor": "rgb(17,17,17)", "plot_bgcolor": "rgb(17,17,17)", "polar": {"angularaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "bgcolor": "rgb(17,17,17)", "radialaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}}, "scene": {"xaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3"}, "yaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3"}, "zaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3"}}, "shapedefaults": {"line": {"color": "#f2f5fa"}}, "sliderdefaults": {"bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0}, "ternary": {"aaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "baxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "bgcolor": "rgb(17,17,17)", "caxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}}, "title": {"x": 0.05}, "updatemenudefaults": {"bgcolor": "#506784", "borderwidth": 0}, "xaxis": {"automargin": true, "gridcolor": "#283442", "linecolor": "#506784", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "#283442", "zerolinewidth": 2}, "yaxis": {"automargin": true, "gridcolor": "#283442", "linecolor": "#506784", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "#283442", "zerolinewidth": 2}}}, "title": {"text": "19-20\u5e74\u524d\u534a\u5e74\u6708\u5ea6\u4e0d\u540c\u884c\u4e1a\u652f\u4ed8\u8f6c\u5316\u7387"}, "uniformtext": {"minsize": 8}, "xaxis": {"tickangle": 50, "tickfont": {"size": 17}, "title": {"font": {"size": 15}, "text": "\u884c\u4e1a\u7c7b\u76ee"}}, "yaxis": {"tickfont": {"size": 17}, "title": {"font": {"size": 15}, "text": "\u9500\u552e\u91d1\u989d"}}},
                    {"responsive": true}
                ).then(function(){

var gd = document.getElementById(‘2c2777ab-e6f5-4c32-84dd-8023395d8d22’);
var x = new MutationObserver(function (mutations, observer) {{
var display = window.getComputedStyle(gd).display;
if (!display || display === ‘none’) {{
console.log([gd, ‘removed!’]);
Plotly.purge(gd);
observer.disconnect();
}}
}});

// Listen for the removal of the full notebook cells
var notebookContainer = gd.closest(’#notebook-container’);
if (notebookContainer) {{
x.observe(notebookContainer, {childList: true});
}}

// Listen for the clearing of the current output cell
var outputEl = gd.closest(’.output’);
if (outputEl) {{
x.observe(outputEl, {childList: true});
}}

                    })
            };
            });
        </script>
    </div>
group_kedanjia_hyjc19=round(pd.DataFrame(data_19.groupby("行业简称")["客单价"].mean()),2)
group_kedanjia_hyjc20=round(pd.DataFrame(data_20.groupby("行业简称")["客单价"].mean()),2)
group_kedanjia_hyjc19.head(1),group_kedanjia_hyjc20.head(1)
(          客单价
 行业简称         
 女装    1611.55,           客单价
 行业简称         
 女装    1457.24)
fig=go.Figure(data=[
    go.Bar(name="2019年",x=group_kedanjia_hyjc19.index,y=group_kedanjia_hyjc19.iloc[:,0]
           ,text=group_kedanjia_hyjc19.iloc[:,0],textposition="inside"),
    go.Bar(name="2020年",x=group_kedanjia_hyjc20.index,y=group_kedanjia_hyjc20.iloc[:,0]
           ,text=group_kedanjia_hyjc20.iloc[:,0],textposition="inside")
])
fig.update_traces(marker_line_width=0.5,marker_line_color="cyan")
fig.update_layout(xaxis=dict(title="行业类目",titlefont_size=17,tickfont_size=17)
                 ,yaxis=dict(title="客单价",titlefont_size=17,tickfont_size=17)
                 ,bargroupgap=0.01,uniformtext_minsize=8,bargap=0.25
                 ,title_text="19-20年前半年月度不同行业客单价")
fig.show()
        <div id="e0c5deb1-dbb5-46bd-a676-f886de3956b4" class="plotly-graph-div" style="height:525px; width:100%;"></div>
        <script type="text/javascript">
            require(["plotly"], function(Plotly) {
                window.PLOTLYENV=window.PLOTLYENV || {};
                
            if (document.getElementById("e0c5deb1-dbb5-46bd-a676-f886de3956b4")) {
                Plotly.newPlot(
                    'e0c5deb1-dbb5-46bd-a676-f886de3956b4',
                    [{"marker": {"line": {"color": "cyan", "width": 0.5}}, "name": "2019\u5e74", "text": [1611.55, 922.28, 596.8, 1381.88, 1092.94, 810.33, 409.13, 476.1, 313.81, 621.91, null, 938.73, 520.99], "textposition": "inside", "type": "bar", "x": ["\u5973\u88c5", "\u5973\u978b", "\u5c3f\u7247\u6d17\u62a4", "\u624b\u8868", "\u7537\u88c5", "\u7537\u978b", "\u773c\u955c", "\u7ae5\u88c5", "\u7ae5\u978b", "\u7bb1\u5305", "\u7f8e\u5bb9\u62a4\u80a4", "\u8fd0\u52a8\u978b", "\u9970\u54c1"], "y": [1611.55, 922.28, 596.8, 1381.88, 1092.94, 810.33, 409.13, 476.1, 313.81, 621.91, null, 938.73, 520.99]}, {"marker": {"line": {"color": "cyan", "width": 0.5}}, "name": "2020\u5e74", "text": [1457.24, 966.91, 631.29, 1542.38, 984.89, 780.53, 315.77, 452.56, 291.0, 519.91, 968.88, 979.45, 551.09], "textposition": "inside", "type": "bar", "x": ["\u5973\u88c5", "\u5973\u978b", "\u5c3f\u7247\u6d17\u62a4", "\u624b\u8868", "\u7537\u88c5", "\u7537\u978b", "\u773c\u955c", "\u7ae5\u88c5", "\u7ae5\u978b", "\u7bb1\u5305", "\u7f8e\u5bb9\u62a4\u80a4", "\u8fd0\u52a8\u978b", "\u9970\u54c1"], "y": [1457.24, 966.91, 631.29, 1542.38, 984.89, 780.53, 315.77, 452.56, 291.0, 519.91, 968.88, 979.45, 551.09]}],
                    {"bargap": 0.25, "bargroupgap": 0.01, "template": {"data": {"bar": [{"error_x": {"color": "#2a3f5f"}, "error_y": {"color": "#2a3f5f"}, "marker": {"line": {"color": "#E5ECF6", "width": 0.5}}, "type": "bar"}], "barpolar": [{"marker": {"line": {"color": "#E5ECF6", "width": 0.5}}, "type": "barpolar"}], "carpet": [{"aaxis": {"endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f"}, "baxis": {"endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f"}, "type": "carpet"}], "choropleth": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "choropleth"}], "contour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "contour"}], "contourcarpet": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "contourcarpet"}], "heatmap": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmap"}], "heatmapgl": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmapgl"}], "histogram": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "histogram"}], "histogram2d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2d"}], "histogram2dcontour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2dcontour"}], "mesh3d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "mesh3d"}], "parcoords": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "parcoords"}], "pie": [{"automargin": true, "type": "pie"}], "scatter": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatter"}], "scatter3d": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatter3d"}], "scattercarpet": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattercarpet"}], "scattergeo": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattergeo"}], "scattergl": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattergl"}], "scattermapbox": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattermapbox"}], "scatterpolar": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolar"}], "scatterpolargl": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolargl"}], "scatterternary": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterternary"}], "surface": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "surface"}], "table": [{"cells": {"fill": {"color": "#EBF0F8"}, "line": {"color": "white"}}, "header": {"fill": {"color": "#C8D4E3"}, "line": {"color": "white"}}, "type": "table"}]}, "layout": {"annotationdefaults": {"arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1}, "coloraxis": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "colorscale": {"diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]], "sequential": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "sequentialminus": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]]}, "colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52"], "font": {"color": "#2a3f5f"}, "geo": {"bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white"}, "hoverlabel": {"align": "left"}, "hovermode": "closest", "mapbox": {"style": "light"}, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": {"angularaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "bgcolor": "#E5ECF6", "radialaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}}, "scene": {"xaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white"}, "yaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white"}, "zaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white"}}, "shapedefaults": {"line": {"color": "#2a3f5f"}}, "ternary": {"aaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "baxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "bgcolor": "#E5ECF6", "caxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}}, "title": {"x": 0.05}, "xaxis": {"automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "white", "zerolinewidth": 2}, "yaxis": {"automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "white", "zerolinewidth": 2}}}, "title": {"text": "19-20\u5e74\u524d\u534a\u5e74\u6708\u5ea6\u4e0d\u540c\u884c\u4e1a\u5ba2\u5355\u4ef7"}, "uniformtext": {"minsize": 8}, "xaxis": {"tickfont": {"size": 17}, "title": {"font": {"size": 17}, "text": "\u884c\u4e1a\u7c7b\u76ee"}}, "yaxis": {"tickfont": {"size": 17}, "title": {"font": {"size": 17}, "text": "\u5ba2\u5355\u4ef7"}}},
                    {"responsive": true}
                ).then(function(){

var gd = document.getElementById(‘e0c5deb1-dbb5-46bd-a676-f886de3956b4’);
var x = new MutationObserver(function (mutations, observer) {{
var display = window.getComputedStyle(gd).display;
if (!display || display === ‘none’) {{
console.log([gd, ‘removed!’]);
Plotly.purge(gd);
observer.disconnect();
}}
}});

// Listen for the removal of the full notebook cells
var notebookContainer = gd.closest(’#notebook-container’);
if (notebookContainer) {{
x.observe(notebookContainer, {childList: true});
}}

// Listen for the clearing of the current output cell
var outputEl = gd.closest(’.output’);
if (outputEl) {{
x.observe(outputEl, {childList: true});
}}

                    })
            };
            });
        </script>
    </div>

对女装行业进行分析

nvzhuang_data19=data_19[data_19["行业简称"]=="女装"]
nvzhuang_data20=data_20[data_20["行业简称"]=="女装"]
nvzhuang_data19.head()
platformcidindustrycategorythemonth销售额访客客群指数行业简称年月uv价值客单价支付转化率%
1367天猫1623女装/女士精品半身裙2019-01-014.466077e+0859951518357486女装1月2019年2019年1月7.4494811249.3011790.60
1368天猫50008905女装/女士精品皮草2019-01-017.872206e+0837363055114703女装1月2019年2019年1月21.0694936863.1213920.31
1369天猫1624女装/女士精品套装/学生校服/工作制服2019-01-014.838582e+0879136374252168女装1月2019年2019年1月6.1142321918.7929150.32
1370天猫50008906女装/女士精品唐装/民族服装/舞台服装2019-01-011.336768e+081844341799300女装1月2019年2019年1月7.2479411346.1913240.54
1371天猫1629女装/女士精品大码女装2019-01-012.037671e+0837338292166670女装1月2019年2019年1月5.4573231222.5781810.45
print(nvzhuang_data19.shape,nvzhuang_data20.shape)
(156, 15) (168, 15)
nvzhuang_data19[nvzhuang_data19["category"]=="半身裙"]
platformcidindustrycategorythemonth销售额访客客群指数行业简称年月uv价值客单价支付转化率%
1367天猫1623女装/女士精品半身裙2019-01-014.466077e+0859951518357486女装1月2019年2019年1月7.4494811249.3011790.60
1621天猫1623女装/女士精品半身裙2019-02-012.327357e+0850756055224816女装2月2019年2019年2月4.5853771035.2273240.44
1851天猫1623女装/女士精品半身裙2019-03-015.420076e+0869248237351472女装3月2019年2019年3月7.8270241542.1074960.51
2079天猫1623女装/女士精品半身裙2019-04-015.447526e+0877831735364783女装4月2019年2019年4月6.9991071493.3607820.47
2310天猫1623女装/女士精品半身裙2019-05-015.905490e+0879853688374942女装5月2019年2019年5月7.3953881575.0408510.47
2542天猫1623女装/女士精品半身裙2019-06-017.536072e+0879367316414379女装6月2019年2019年6月9.4951831818.6422470.52
group_nz19=nvzhuang_data19.groupby("category").mean()
group_nz19.head()
cid销售额访客客群指数uv价值客单价支付转化率%
category
T恤50000671.01.257984e+091.203158e+08718911.0000009.6097031608.1768650.593333
中老年女装50000852.06.886066e+083.317840e+07311193.66666719.8750632106.1777820.928333
半身裙1623.05.183766e+086.950142e+07347979.6666677.2919261452.2799800.501667
卫衣/绒衫50008898.03.197252e+085.700351e+07264378.3333334.9626021069.7477490.451667
唐装/民族服装/舞台服装50008906.01.393532e+082.320995e+07112846.3333335.9293521210.5266260.486667
group_nz20=nvzhuang_data20.groupby("category").mean()
group_nz20.head()
cid销售额访客客群指数uv价值客单价支付转化率%
category
POLO衫201241307.02.166939e+071.438497e+0747115.3333331.161371338.8810900.371667
T恤50000671.01.362343e+091.256923e+08717053.8333339.8561951716.7036680.560000
中老年女装50000852.05.996674e+083.963370e+07299450.66666714.2563781865.3040940.755000
半身裙1623.04.609738e+086.400985e+07301392.5000006.9086281465.1966730.465000
卫衣/绒衫50008898.03.518318e+086.216196e+07278895.8333335.2638231153.2190170.460000
uv_19vs20=pd.merge(left=group_nz19["uv价值"],right=group_nz20["uv价值"],on="category",how="inner")
# uv_19vs20.rename(columns={""})
uv_19vs20.columns=["19年uv价值","20年uv价值"]
uv_19vs20["uv价值变化"]=uv_19vs20['20年uv价值']-uv_19vs20["19年uv价值"]
uv_19vs20.head()
19年uv价值20年uv价值uv价值变化
category
T恤9.6097039.8561950.246491
中老年女装19.87506314.256378-5.618685
半身裙7.2919266.908628-0.383299
卫衣/绒衫4.9626025.2638230.301222
唐装/民族服装/舞台服装5.9293523.873985-2.055367
fig=plt.figure()
ax1=fig.add_subplot(111)
uv_19vs20.iloc[:,[0,1]].plot.bar(figsize=(15,6),ax=ax1)
plt.ylabel("uv价值",fontsize=15)
plt.xlabel("二级类目",fontsize=15)
plt.legend(loc=1)
plt.axhline(0,c="skyblue",linestyle="--")

ax2=ax1.twinx()
uv_19vs20["uv价值变化"].plot(secondary_y=True,label="uv价值变化",c="skyblue")
plt.legend(loc=9)
plt.axhline(0,linestyle="--",c="royalblue")
<matplotlib.lines.Line2D at 0x158b37e0f98>

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rGI2fSuT-1597195737524)(out在这里插入图片描述
put_42_1.png)]

rate_19vs20=pd.merge(left=round(group_nz19["支付转化率%"],2),right=round(group_nz20["支付转化率%"],2),on="category",how="inner")
# uv_19vs20.rename(columns={""})
rate_19vs20.columns=["19年支付转化率%","20年支付转化率%"]
rate_19vs20["支付转化率变化率%"]=rate_19vs20['20年支付转化率%']-rate_19vs20["19年支付转化率%"]
rate_19vs20.shape
(26, 3)
# plt.figure(dpi=1000)
# rate_19vs20.iloc[:,[0,1]].plot.bar(figsize=(25,9),width = 0.65,alpha=0.8)
# plt.ylabel("支付转化率",fontsize=20)
# plt.xlabel("二级类目",fontsize=15)
# rate_19vs20['支付转化率变化率%'].plot(secondary_y=True,label="支付转化率变化率",c="deeppink")
# plt.xticks(range(0,26))
# plt.legend(loc=2)
# plt.xticks(rotation=45)
# plt.axhline(0,color='g',linestyle="--",alpha=0.8)
# plt.title("19-20年女装行业下各类目的支付转化率及同比变化率",fontsize=20,pad=30)
fig=plt.figure()
ax1=fig.add_subplot(111)
rate_19vs20.iloc[:,[0,1]].plot.bar(figsize=(15,6),width = 0.65,alpha=0.8,ax=ax1)
plt.ylabel("支付转化率",fontsize=20)
plt.xlabel("二级类目",fontsize=15)
plt.xticks(range(0,26))
plt.legend(loc=1)
plt.xticks(rotation=80,fontsize=13)
plt.title("19-20年女装行业下各类目的支付转化率及同比变化率",fontsize=20,pad=30)

ax2=ax1.twinx()
rate_19vs20['支付转化率变化率%'].plot(secondary_y=True,label="支付转化率变化率",c="deeppink")
plt.legend(loc=2)
plt.axhline(0,color='g',linestyle="--",alpha=0.8)
<matplotlib.lines.Line2D at 0x158b39b1f60>

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Em3rneMY-159719在这里在这里插入图片描述
插入图片描述
5737525)(output_45_1.png)]

sales_19vs20=pd.merge(left=group_nz19["销售额"],right=group_nz20["销售额"],on="category",how="inner")
sales_19vs20.columns=["19年销售额","20年销售额"]
pay_19vs20=pd.merge(left=group_nz19["客群指数"],right=group_nz20["客群指数"],on="category",how="inner")
pay_19vs20.columns=["19年支付买家数","20年支付买家数"]
uv_19vs20=pd.merge(left=group_nz19["访客"],right=group_nz20["访客"],on="category",how="inner")
uv_19vs20.columns=["19年访客数","20年访客数"]
kdj_19vs20=pd.merge(left=group_nz19["客单价"],right=group_nz20["客单价"],on="category",how="inner")
kdj_19vs20.columns=["19年客单价","20年客单价"]
fig=plt.figure(figsize=(15,12))
plt.subplots_adjust(hspace=0.5)
ax1=fig.add_subplot(2,2,1)
sales_19vs20.iloc[:,[0,1]].plot.bar(ax=ax1,grid=True)
plt.ylabel("19vs20年销售额",fontsize=13)
# plt.annotate("抹胸的支付转化率最高",xy=(15,100),xytext=(15,100),color="r")
plt.legend(loc=2)

ax2=fig.add_subplot(2,2,2)
pay_19vs20.iloc[:,[0,1]].plot(kind="bar",ax=ax2,grid=True)
plt.ylabel("19vs20年支付买家数",fontsize=13)
plt.legend(loc=9)

ax3=fig.add_subplot(2,2,3)
uv_19vs20.iloc[:,[0,1]].plot(kind="bar",grid=True,ax=ax3)
plt.ylabel("19vs20年访客数",fontsize=13)

ax4=fig.add_subplot(2,2,4)
kdj_19vs20.iloc[:,[0,1]].plot(kind="bar",grid=True,ax=ax4)
plt.ylabel("19vs20年客单价",fontsize=13)
Text(0, 0.5, '19vs20年客单价')

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-lhRZRGtu-1597195737526)(o在这里插入图片描述
utput_47_1.png)]

group_nz_date19=nvzhuang_data19.groupby("月").mean()
group_nz_date20=nvzhuang_data20.groupby("月").mean()
group_nz_date19.head()
cid销售额访客客群指数uv价值客单价支付转化率%
1月4.013978e+076.201391e+085.482015e+07270093.30769210.1849872179.6363490.590385
2月4.013978e+072.647202e+084.602366e+07190040.5000005.3073611366.2959850.501154
3月4.013978e+075.688518e+086.068842e+07294243.5769238.3045101755.8480360.550769
4月4.013978e+074.919570e+085.695079e+07273866.6538466.7796551421.6888900.536538
5月4.013978e+075.075923e+085.553469e+07267777.6153856.7378621363.7924720.532308
sales_nz_date19vs20=pd.merge(group_nz_date19["销售额"],group_nz_date20["销售额"],on="月",how="inner")
sales_nz_date19vs20.columns=["19年女装销售额","20年女装销售额"]
sales_nz_date19vs20["销售额变化率%"]=round(((sales_nz_date19vs20["20年女装销售额"]/sales_nz_date19vs20["19年女装销售额"])-1)*100,2)
sales_nz_date19vs20
19年女装销售额20年女装销售额销售额变化率%
1月6.201391e+084.833935e+08-22.05
2月2.647202e+081.806037e+08-31.78
3月5.688518e+084.693935e+08-17.48
4月4.919570e+084.317268e+08-12.24
5月5.075923e+085.528601e+088.92
6月6.026104e+086.483473e+087.59
fig=plt.figure(figsize=(10,6))
ax1=fig.add_subplot(111)
sales_nz_date19vs20.iloc[:,[0,1]].plot.bar(ax=ax1,width=0.7)
plt.xticks(rotation=0,fontsize=13,horizontalalignment="left")
plt.legend(loc=2)

ax2=ax1.twinx()
sales_nz_date19vs20.iloc[:,2].plot(ax=ax2,color="deeppink",label="销售额变化率")
ax2.legend(bbox_to_anchor=(0.19,0.88))
plt.axhline(0,color='g',linestyle="--",alpha=0.8)
<matplotlib.lines.Line2D at 0x158b41024a8>

[外链图片转存失败,源站可能有防盗在这里插入图片描述
链机制,建议将图片保存下来直接上传(img-pKHWEJrY-1597195737528)(output_50_1.png)]

fig=go.Figure(data=[
    go.Bar(name="2019年",x=sales_nz_date19vs20.index,y=sales_nz_date19vs20.iloc[:,0],text=sales_nz_date19vs20.iloc[:,0],marker_color="skyblue"),
    go.Bar(name="2020年",x=sales_nz_date19vs20.index,y=sales_nz_date19vs20.iloc[:,1],text=sales_nz_date19vs20.iloc[:,0],marker_color="deeppink")
])
fig.update_traces(marker_line_color="yellow")
fig.update_layout(title_text="2019-2020年女装行业月度销售额"
                 ,xaxis=dict(title="月份",titlefont_size=17,tickfont_size=17)
                 ,yaxis=dict(title="销售额",titlefont_size=17,tickfont_size=17)
                 ,bargap=0.25)
fig.show()
        <div id="419c9272-615e-4098-992d-a1f67004d2e7" class="plotly-graph-div" style="height:525px; width:100%;"></div>
        <script type="text/javascript">
            require(["plotly"], function(Plotly) {
                window.PLOTLYENV=window.PLOTLYENV || {};
                
            if (document.getElementById("419c9272-615e-4098-992d-a1f67004d2e7")) {
                Plotly.newPlot(
                    '419c9272-615e-4098-992d-a1f67004d2e7',
                    [{"marker": {"color": "skyblue", "line": {"color": "yellow"}}, "name": "2019\u5e74", "text": [620139125.5723077, 264720194.55461538, 568851762.5388463, 491956992.3761537, 507592336.0873076, 602610435.3265386], "type": "bar", "x": ["1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708"], "y": [620139125.5723077, 264720194.55461538, 568851762.5388463, 491956992.3761537, 507592336.0873076, 602610435.3265386]}, {"marker": {"color": "deeppink", "line": {"color": "yellow"}}, "name": "2020\u5e74", "text": [620139125.5723077, 264720194.55461538, 568851762.5388463, 491956992.3761537, 507592336.0873076, 602610435.3265386], "type": "bar", "x": ["1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708"], "y": [483393499.15464294, 180603730.79821426, 469393509.6399999, 431726750.58714294, 552860100.2885715, 648347268.1314285]}],
                    {"bargap": 0.25, "template": {"data": {"bar": [{"error_x": {"color": "#2a3f5f"}, "error_y": {"color": "#2a3f5f"}, "marker": {"line": {"color": "#E5ECF6", "width": 0.5}}, "type": "bar"}], "barpolar": [{"marker": {"line": {"color": "#E5ECF6", "width": 0.5}}, "type": "barpolar"}], "carpet": [{"aaxis": {"endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f"}, "baxis": {"endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f"}, "type": "carpet"}], "choropleth": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "choropleth"}], "contour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "contour"}], "contourcarpet": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "contourcarpet"}], "heatmap": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmap"}], "heatmapgl": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "heatmapgl"}], "histogram": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "histogram"}], "histogram2d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2d"}], "histogram2dcontour": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "histogram2dcontour"}], "mesh3d": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "type": "mesh3d"}], "parcoords": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "parcoords"}], "pie": [{"automargin": true, "type": "pie"}], "scatter": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatter"}], "scatter3d": [{"line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatter3d"}], "scattercarpet": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattercarpet"}], "scattergeo": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattergeo"}], "scattergl": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattergl"}], "scattermapbox": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scattermapbox"}], "scatterpolar": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolar"}], "scatterpolargl": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterpolargl"}], "scatterternary": [{"marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "type": "scatterternary"}], "surface": [{"colorbar": {"outlinewidth": 0, "ticks": ""}, "colorscale": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "type": "surface"}], "table": [{"cells": {"fill": {"color": "#EBF0F8"}, "line": {"color": "white"}}, "header": {"fill": {"color": "#C8D4E3"}, "line": {"color": "white"}}, "type": "table"}]}, "layout": {"annotationdefaults": {"arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1}, "coloraxis": {"colorbar": {"outlinewidth": 0, "ticks": ""}}, "colorscale": {"diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]], "sequential": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]], "sequentialminus": [[0.0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1.0, "#f0f921"]]}, "colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52"], "font": {"color": "#2a3f5f"}, "geo": {"bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white"}, "hoverlabel": {"align": "left"}, "hovermode": "closest", "mapbox": {"style": "light"}, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": {"angularaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "bgcolor": "#E5ECF6", "radialaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}}, "scene": {"xaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white"}, "yaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white"}, "zaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white"}}, "shapedefaults": {"line": {"color": "#2a3f5f"}}, "ternary": {"aaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "baxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "bgcolor": "#E5ECF6", "caxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}}, "title": {"x": 0.05}, "xaxis": {"automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "white", "zerolinewidth": 2}, "yaxis": {"automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": {"standoff": 15}, "zerolinecolor": "white", "zerolinewidth": 2}}}, "title": {"text": "2019-2020\u5e74\u5973\u88c5\u884c\u4e1a\u6708\u5ea6\u9500\u552e\u989d"}, "xaxis": {"tickfont": {"size": 17}, "title": {"font": {"size": 17}, "text": "\u6708\u4efd"}}, "yaxis": {"tickfont": {"size": 17}, "title": {"font": {"size": 17}, "text": "\u9500\u552e\u989d"}}},
                    {"responsive": true}
                ).then(function(){

var gd = document.getElementById(‘419c9272-615e-4098-992d-a1f67004d2e7’);
var x = new MutationObserver(function (mutations, observer) {{
var display = window.getComputedStyle(gd).display;
if (!display || display === ‘none’) {{
console.log([gd, ‘removed!’]);
Plotly.purge(gd);
observer.disconnect();
}}
}});

// Listen for the removal of the full notebook cells
var notebookContainer = gd.closest(’#notebook-container’);
if (notebookContainer) {{
x.observe(notebookContainer, {childList: true});
}}

// Listen for the clearing of the current output cell
var outputEl = gd.closest(’.output’);
if (outputEl) {{
x.observe(outputEl, {childList: true});
}}

                    })
            };
            });
        </script>
    </div>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值