网易考拉口红数据分析


口红是一类唇用美容化妆品,其主要功能是赋予嘴唇以色调,强调或改变两唇的轮廓,显示出更有生气和活力。

早在公元前3500年,人类便已开始使用一些带色的矿物和植物色素涂抹在面颊和唇上,以达到美容的目的。随着美容化妆品的发展,口红的色调、配方和功能都有较大的变化。 口红的色调与女性的发型、指甲油色调和服装变化密切相关,变得更具有潮流色彩。特别是近年来各种珠光粉和处理颜料的使用,使口红的色调更加多样化,质感更加舒适。与其他美容化妆品的发展趋势相似,它继续保持美容为主,兼顾保湿、滋养和防晒功能。

评论数分析

评论数在一定程度上能够反映品牌的热度,Dior,资生堂,MAC,圣罗兰四大品牌热度远高于其他品牌,长期受到广大女性追捧,可以看到在网易考拉网上,迪奥的市场份额属于第一梯队,资生堂、圣罗兰、纪梵希、MAC属第二梯队。

品牌产地

这些热门品牌口红大多产于法国,法国占比达到52.2%,其次是美国,国产口红仅占比2.22%,欧洲系列口红显然更受消费者青睐

品牌sku数

SKU:SKU=Stock Keeping Unit(库存量单位) ,即库存进出计量的单位;以服装为例可以是以件为单位。 是一种表示库存进出计量的单位,例如,盒,件。如今的sku被广泛引申为某款产品的统一编号的简称,每一个产品都有它独一无二的sku号。sku号包括其商品的品牌、型号、等级、配置、单位、用途、产地、价格、生产日期、保质期等等一系列属性,每一件商品的这些属性与其他任何商品都不一样,这样的商品称为一个单品,其sku号是独一无二的。

品牌中迪奥是消费者的主要选择;而位于最后的KIKO,梦妆,曼秀雷敦则比较小众;

热门品牌top数

透过这组数据,我们发现一个很有意思的情况,KIKO MILANO属于热门品牌,但确不是大家的热门购买,大家都属于观望,而其他几个牌子符合预期

由上可以得出结论,Dior,MAC,圣罗兰,纪梵希是当前四大热门品牌,而他们大多是来及法国的品牌

后端代码

import numpy as np
import pandas as pd
from flask import Flask, render_template

app = Flask(__name__)
app.jinja_env.filters['zip'] = zip

@app.route('/')
def lip():
    df = pd.read_excel("E:/BigData/data/lipsticks.xlsx")
    df.fillna({'原价': df['折扣价'], '是否自营': '非自营'}, inplace=True)
    df['price_0'] = df['原价'].replace('新人价', df['折扣价'])

    def cut_price(x):
        position = x.find('¥')
        price = float(x[position + 1:])
        return price

    df['disprice'] = df['折扣价'].apply(cut_price)

    def cut_discount(x, y):
        position = x.find('¥')
        if position != -1:
            price = float(x[position + 1:])
            return price
        else:
            discount = float(x[:len(x) - 1])
            price = y * 10 / discount
            return price

    df['price'] = df.apply(lambda x: cut_discount(x['price_0'], x['disprice']), axis=1)
    df['price'] = df['price'].round(2)
    df['discount'] = (df['disprice'] / df['price']).round(2)
    ax1 = df.groupby('品牌')['评论数'].sum().sort_values(ascending=True)
    ax2 = df['国家'].value_counts()
    ax3 = df['品牌'].value_counts().sort_values(ascending=True)
    bv1 = ax1.values
    bx1 = ax1.index.tolist()
    bv2 = ax2.values
    bx2 = ax2.index.tolist()
    bv3 = ax3.values
    bx3 = ax3.index.tolist()
    df_comments_mean = df.groupby('品牌')['评论数'].mean().sort_values(ascending=True)
    ax4 = df_comments_mean[-10:]
    bv4 = ax4.values
    bx4 = ax4.index.tolist()
    return render_template('comment.html', bv1=bv1, bx1=bx1, bv2=bv2, bx2=bx2, bv3=bv3, bx3=bx3, bv4=bv4, bx4=bx4)

if __name__ == "__main__":
    app.run(debug=True)
# lip()

前端代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>comment</title>
     <script src="../static/echarts.js"></script>
</head>
<body>
<div id="top" style="width: 1200px; height: 600px; padding: 20px;"></div>
    <div id="bottom" style="width: 1200px; height: 600px; padding: 20px;"></div>
    <div id="second" style="width: 1200px; height: 600px; padding: 20px;"></div>
    <div id="four" style="width: 1200px; height: 600px; padding: 20px;"></div>
    <script type="text/javascript">
        var myTop = echarts.init(document.getElementById('top'));
        var myBottom = echarts.init(document.getElementById('bottom'));
        var mysecond = echarts.init(document.getElementById('second'));
        var myfour = echarts.init(document.getElementById('four'));
        option = {
            title: {
        text: '品牌评论数',
        subtext: '数据来自网易考拉'
    },
    grid: {containLabel: true},
    xAxis: {
        type: 'value',
        boundaryGap: [0, 0.01]
    },
    yAxis: {
        type: 'category',
        data: [{% for p in bx1 %}'{{ p }}', {% endfor %}]
    },
    visualMap: {
        orient: 'horizontal',
        left: 'center',
        min: 10,
        max: 80000,
        text: ['High Score', 'Low Score'],
        // Map the score column to color
        dimension: 0,
        inRange: {
            color: ['#D7DA8B', '#E15457']
        }
    },
    series: [
        {
            type: 'bar',

            data:[
                {% for p in bv1%} {{ p }},{% endfor %}
            ]
        }
    ]
};
        bottomoption = {
    title: {
        text: '产地国家占比',
        subtext: '数据来自网易考拉',
        left: 'center'
    },
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b} : {c} ({d}%)'
    },
    legend: {
        orient: 'vertical',
        left: 'left',
        data: [{% for p in bx2 %}'{{ p }}', {% endfor %}]
    },
    series: [
        {
            name: '产地国家占比',
            type: 'pie',
            radius: '55%',
            center: ['50%', '60%'],
            data: [
                {% for v,p in bv2|zip(bx2)%}{
                     value: {{ v }},
                     name: '{{ p }}',
                     },{% endfor %}
            ],
            emphasis: {
                itemStyle: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
};
        threeoption = {
    title: {
        text: '各品牌SKU数',
        subtext: '数据来自网易考拉'
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'value',
        boundaryGap: [0, 0.01]
    },
    yAxis: {
        type: 'category',
        data: [{% for p in bx3 %}'{{ p }}', {% endfor %}]
    },
    series: [

        {

            type: 'bar',
            data: [{% for p in bv3 %}'{{ p }}', {% endfor %}]
        }
    ]
};
    fouroption = {
        color: ['#aadbc8'],
    title: {
        text: '热门品牌top数',
        subtext: '数据来自网易考拉'
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'value',
        boundaryGap: [0, 0.01]
    },
    yAxis: {
        type: 'category',
        data: [{% for p in bx4 %}'{{ p }}', {% endfor %}]
    },
    series: [

        {

            type: 'bar',
            data: [{% for p in bv4 %}'{{ p }}', {% endfor %}]
        }
    ]
};
myTop.setOption(option);
myBottom.setOption(bottomoption);
mysecond.setOption(threeoption);
myfour.setOption(fouroption);
        </script>
</body>
</html>

声明:sma blog|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - 网易考拉口红数据分析


Carpe Diem and Do what I like