search
HomeBackend DevelopmentPython TutorialPandas+Pyecharts | Visualization of Double Eleven beauty sales data analysis


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')
##2. Pandas data processing

##2.1 Read data

df_school = pd.read_excel('data.xlsx')

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

2.2 Data information

df.info()

2.3 筛选有销量的数据 

df1 = df.copy()
df1 = df1[df1['销量']>0]
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)
            )
        )
    )
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()
    )
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) 
        )
    )

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!

Statement
This article is reproduced at:Python当打之年. If there is any infringement, please contact admin@php.cn delete
python pandas安装方法python pandas安装方法Nov 22, 2023 pm 02:33 PM

python可以通过使用pip、使用conda、从源代码、使用IDE集成的包管理工具来安装pandas。详细介绍:1、使用pip,在终端或命令提示符中运行pip install pandas命令即可安装pandas;2、使用conda,在终端或命令提示符中运行conda install pandas命令即可安装pandas;3、从源代码安装等等。

pandas写入excel有哪些方法pandas写入excel有哪些方法Nov 22, 2023 am 11:46 AM

pandas写入excel的方法有:1、安装所需的库;2、读取数据集;3、写入Excel文件;4、指定工作表名称;5、格式化输出;6、自定义样式。Pandas是一个流行的Python数据分析库,提供了许多强大的数据清洗和分析功能,要将Pandas数据写入Excel文件,可以使用Pandas提供的“to_excel()”方法。

如何使用Python中的Pandas按特定列合并两个CSV文件?如何使用Python中的Pandas按特定列合并两个CSV文件?Sep 08, 2023 pm 02:01 PM

CSV(逗号分隔值)文件广泛用于以简单格式存储和交换数据。在许多数据处理任务中,需要基于特定列合并两个或多个CSV文件。幸运的是,这可以使用Python中的Pandas库轻松实现。在本文中,我们将学习如何使用Python中的Pandas按特定列合并两个CSV文件。什么是Pandas库?Pandas是一个用于Python信息控制和检查的开源库。它提供了用于处理结构化数据(例如表格、时间序列和多维数据)以及高性能数据结构的工具。Pandas广泛应用于金融、数据科学、机器学习和其他需要数据操作的领域。

日常工作中,Python+Pandas是否能代替Excel+VBA?日常工作中,Python+Pandas是否能代替Excel+VBA?May 04, 2023 am 11:37 AM

知乎上有个热门提问,日常工作中Python+Pandas是否能代替Excel+VBA?我的建议是,两者是互补关系,不存在谁替代谁。复杂数据分析挖掘用Python+Pandas,日常简单数据处理用Excel+VBA。从数据处理分析能力来看,Python+Pandas肯定是能取代Excel+VBA的,而且要远远比后者强大。但从便利性、传播性、市场认可度来看,Excel+VBA在职场工作上还是无法取代的。因为Excel符合绝大多数人的使用习惯,使用成本更低。就像Photoshop能修出更专业的照片,为

时间序列特征提取的Python和Pandas代码示例时间序列特征提取的Python和Pandas代码示例Apr 12, 2023 pm 05:43 PM

使用Pandas和Python从时间序列数据中提取有意义的特征,包括移动平均,自相关和傅里叶变换。前言时间序列分析是理解和预测各个行业(如金融、经济、医疗保健等)趋势的强大工具。特征提取是这一过程中的关键步骤,它涉及将原始数据转换为有意义的特征,可用于训练模型进行预测和分析。在本文中,我们将探索使用Python和Pandas的时间序列特征提取技术。在深入研究特征提取之前,让我们简要回顾一下时间序列数据。时间序列数据是按时间顺序索引的数据点序列。时间序列数据的例子包括股票价格、温度测量和交通数据。

pandas如何读取txt文件pandas如何读取txt文件Nov 21, 2023 pm 03:54 PM

pandas读取txt文件的步骤:1、安装Pandas库;2、使用“read_csv”函数读取txt文件,并指定文件路径和文件分隔符;3、Pandas将数据读取为一个名为DataFrame的对象;4、如果第一行包含列名,则可以通过将header参数设置为0来指定,如果没有,则设置为None;5、如果txt文件中包含缺失值或空值,可以使用“na_values”指定这些缺失值。

4000字详细说明,推荐20个好用到爆的Pandas函数方法4000字详细说明,推荐20个好用到爆的Pandas函数方法Aug 10, 2023 pm 02:52 PM

今天分享几个不为人知的pandas函数,大家可能平时看到的不多,但是使用起来倒是非常的方便,也能够帮助我们数据分析人员大幅度地提高工作效率,同时也希望大家看完之后能够有所收获。

pandas怎么读取csv文件pandas怎么读取csv文件Dec 01, 2023 pm 04:18 PM

读取CSV文件的方法有使用read_csv()函数、指定分隔符、指定列名、跳过行、缺失值处理、自定义数据类型等。详细介绍:1、read_csv()函数是Pandas中最常用的读取CSV文件的方法。它可以从本地文件系统或远程URL加载CSV数据,并返回一个DataFrame对象;2、指定分隔符,默认情况下,read_csv()函数将使用逗号作为CSV文件的分隔符等等。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.