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

Aug 08, 2023 pm 05:05 PM
pandas pyecharts


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!

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

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)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Solving common pandas installation problems: interpretation and solutions to installation errors Solving common pandas installation problems: interpretation and solutions to installation errors Feb 19, 2024 am 09:19 AM

Pandas installation tutorial: Analysis of common installation errors and their solutions, specific code examples are required Introduction: Pandas is a powerful data analysis tool that is widely used in data cleaning, data processing, and data visualization, so it is highly respected in the field of data science . However, due to environment configuration and dependency issues, you may encounter some difficulties and errors when installing pandas. This article will provide you with a pandas installation tutorial and analyze some common installation errors and their solutions. 1. Install pandas

How to read txt file correctly using pandas How to read txt file correctly using pandas Jan 19, 2024 am 08:39 AM

How to use pandas to read txt files correctly requires specific code examples. Pandas is a widely used Python data analysis library. It can be used to process a variety of data types, including CSV files, Excel files, SQL databases, etc. At the same time, it can also be used to read text files, such as txt files. However, when reading txt files, we sometimes encounter some problems, such as encoding problems, delimiter problems, etc. This article will introduce how to read txt correctly using pandas

python pandas installation method python pandas installation method Nov 22, 2023 pm 02:33 PM

Python can install pandas by using pip, using conda, from source code, and using the IDE integrated package management tool. Detailed introduction: 1. Use pip and run the pip install pandas command in the terminal or command prompt to install pandas; 2. Use conda and run the conda install pandas command in the terminal or command prompt to install pandas; 3. From Source code installation and more.

Read CSV files and perform data analysis using pandas Read CSV files and perform data analysis using pandas Jan 09, 2024 am 09:26 AM

Pandas is a powerful data analysis tool that can easily read and process various types of data files. Among them, CSV files are one of the most common and commonly used data file formats. This article will introduce how to use Pandas to read CSV files and perform data analysis, and provide specific code examples. 1. Import the necessary libraries First, we need to import the Pandas library and other related libraries that may be needed, as shown below: importpandasaspd 2. Read the CSV file using Pan

How to install pandas in python How to install pandas in python Dec 04, 2023 pm 02:48 PM

Steps to install pandas in python: 1. Open the terminal or command prompt; 2. Enter the "pip install pandas" command to install the pandas library; 3. Wait for the installation to complete, and you can import and use the pandas library in the Python script; 4. Use It is a specific virtual environment. Make sure to activate the corresponding virtual environment before installing pandas; 5. If you are using an integrated development environment, you can add the "import pandas as pd" code to import the pandas library.

Practical tips for reading txt files using pandas Practical tips for reading txt files using pandas Jan 19, 2024 am 09:49 AM

Practical tips for reading txt files using pandas, specific code examples are required. In data analysis and data processing, txt files are a common data format. Using pandas to read txt files allows for fast and convenient data processing. This article will introduce several practical techniques to help you better use pandas to read txt files, along with specific code examples. Reading txt files with delimiters When using pandas to read txt files with delimiters, you can use read_c

Revealing the efficient data deduplication method in Pandas: Tips for quickly removing duplicate data Revealing the efficient data deduplication method in Pandas: Tips for quickly removing duplicate data Jan 24, 2024 am 08:12 AM

The secret of Pandas deduplication method: a fast and efficient way to deduplicate data, which requires specific code examples. In the process of data analysis and processing, duplication in the data is often encountered. Duplicate data may mislead the analysis results, so deduplication is a very important step. Pandas, a powerful data processing library, provides a variety of methods to achieve data deduplication. This article will introduce some commonly used deduplication methods, and attach specific code examples. The most common case of deduplication based on a single column is based on whether the value of a certain column is duplicated.

Pandas easily reads data from SQL database Pandas easily reads data from SQL database Jan 09, 2024 pm 10:45 PM

Data processing tool: Pandas reads data in SQL databases and requires specific code examples. As the amount of data continues to grow and its complexity increases, data processing has become an important part of modern society. In the data processing process, Pandas has become one of the preferred tools for many data analysts and scientists. This article will introduce how to use the Pandas library to read data from a SQL database and provide some specific code examples. Pandas is a powerful data processing and analysis tool based on Python

See all articles