Home > Backend Development > Python Tutorial > Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis

Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis

Release: 2023-08-08 17:05:40
forward
1229 people have browsed it

This issue uses python to analyze Double Eleven beauty sales data, see Look:

  • The number of beauty orders and total sales in the days before and after Double Eleven

  • Each beauty brandSales situation

  • Proportion of primary/secondary classification of beauty brands

  • Price box distribution of each beauty brand

  • Average price of each beauty brand

  • Beauty brand word cloud

  • Wait...

I hope it will be helpful to everyone. If you have any questions or areas that need improvement, please contact the editor.

Involved libraries:
Pandas — Data processing
Pyecharts — Data visualization

1. Import module

import pandas as pd
from pyecharts.charts import Line
from pyecharts.charts import Bar
from pyecharts.charts import Scatter
from pyecharts.charts import Boxplot
from pyecharts.charts import Pie
from pyecharts.charts import WordCloud
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode
import warnings
warnings.filterwarnings('ignore')
Copy after login
##2. Pandas data processing

##2.1 Read data

df_school = pd.read_excel('data.xlsx')
Copy after login

Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis

2.2 Data information

df.info()
Copy after login

2.3 筛选有销量的数据

df1 = df.copy()
df1 = df1[df1['销量']>0]
Copy after login
Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis
数据过滤后还有24479条。


3. Pyecharts数据可视化

3.1 双十一前后几天美妆订单数量
def get_line1():
    line1 = (
        Line()
        .add_xaxis(x_data)
        .add_yaxis("", y_data,
                   is_smooth=True)
        .set_global_opts(
            legend_opts=opts.LegendOpts(is_show=False),
            visualmap_opts=opts.VisualMapOpts(
                is_show=False,
                min_ = 1500,
                max_ = max(y_data),
                range_color=range_color
            ),
            title_opts=opts.TitleOpts(
                title='1-双十一前后几天美妆订单数量',
                subtitle='-- 制图@公众号:Python当打之年 --',
                pos_top='1%',
                pos_left="1%",
                title_textstyle_opts=opts.TextStyleOpts(color='#fff200',font_size=20)
            )
        )
    )
Copy after login
Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis
在11号前几天订单量持续在比较高的状态,在11月11号后趋于平稳,应该是双十一商家提前预热,消费者的预购订单量比较大。
3.2 双十一前后几天美妆销量

Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis

化妆品的购买高峰在11号前几天,在11月9号达到高峰,消费者的预购销量比较大,和订单量趋势基本保持一致。
3.3 各美妆品牌订单数量
def get_bar1():
    bar1 = (
        Bar()
        .add_xaxis(x_data)
        .add_yaxis("", y_data,label_opts=opts.LabelOpts(position='right'))
        .set_global_opts(
            legend_opts=opts.LegendOpts(is_show=False),
            visualmap_opts=opts.VisualMapOpts(
                is_show=False,
                min_ = min(y_data),
                max_ = max(y_data),
                dimension=0,
                range_color=range_color
            ),
            title_opts=opts.TitleOpts(
                title='3-各美妆品牌订单数量',
                subtitle='-- 制图@公众号:Python当打之年 --',
                pos_top='1%',
                pos_left="1%",
                title_textstyle_opts=opts.TextStyleOpts(color='#fff200',font_size=20)
            ),
        )
        .reversal_axis()
    )
Copy after login
Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis
悦诗风吟的商品数量最多,其次为佰草集、欧莱雅。
3.4 各美妆品牌总销量

Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis

相宜本草的销售额、销量都是最高的,美宝莲、悦诗风吟、妮维雅、欧莱雅分列第二至五位。

3.5 一级分类占比

def get_pie1():
    pie1 = (
        Pie()
        .add(
            "", 
            [list(z) for z in zip(x_data, y_data)],
            radius=["40%", "70%"],
            center=["50%", "50%"],
            label_opts=opts.LabelOpts(formatter="{b}: {d}%",font_size=14,font_weight=500), 
        )
        .set_global_opts(
            title_opts=opts.TitleOpts(
                title='5-一级分类占比',
                subtitle='-- 制图@公众号:Python当打之年 --',
                pos_top='1%',
                pos_left="1%",
                title_textstyle_opts=opts.TextStyleOpts(color='#fff200',font_size=20)
            ),
            legend_opts=opts.LegendOpts(is_show=False) 
        )
    )
Copy after login

Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis

销量第一的还要是护肤品,其次是套装系列和化妆品。
3.6 二级分类占比

Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis

按二级分类来看,订单量前五的分别是:套装类、清洁类、面霜类、化妆水和乳液类。

3.7 二级分类销量

Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis

3.8 Price Box Chart of Each Beauty Brand

Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis

##3.9 Average Price of Each Beauty Brand

Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis

In terms of average price, brands such as Guerlain, Sulwhasoo, Estee Lauder, Lancôme, and Shiseido are slightly more expensive.

3.10 Beauty brand classification word cloud

Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis


##

The above is the detailed content of Pandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:Python当打之年
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template