Advertisement

拉勾网数据分析职位的分析

阅读量:
复制代码
    import pandas as pd
    import numpy as np
    from pandas import DataFrame,Series
    from matplotlib import pyplot as plt
    #添加中文字体
    from pylab import mpl 
    mpl.rcParams['font.sans-serif'] = ['SimHei']
    
    tests = pd.read_excel("/******/copy.xlsx")
复制代码
    #查看数据完整性,只有labels列有缺失值,但是影响并不大
    tests.info()
复制代码
    <class 'pandas.core.frame.DataFrame'>
    RangeIndex: 449 entries, 0 to 448
    Data columns (total 18 columns):
    _clueid           449 non-null int64
    scale             449 non-null object
    salary            449 non-null object
    average_salary    449 non-null float64
    low               449 non-null int64
    top               449 non-null int64
    avg_salary        449 non-null float64
    experience        449 non-null object
    education         449 non-null object
    campany           449 non-null object
    industry          449 non-null object
    scale2            449 non-null object
    phase             449 non-null object
    temptation        449 non-null object
    description       449 non-null object
    district          449 non-null object
    labels            446 non-null object
    city              449 non-null object
    dtypes: float64(2), int64(3), object(13)
    memory usage: 63.2+ KB

清晰数据:
1、将全部重复的列,和无用的列直接在excel中做删除
2、薪资是一个范围区间,可求出平均值来分析,最低工资:=LEFT(C2,FIND(“k”,C2,1)-1),最高工资:=MID(C2,FIND("-",C2)+1,LEN(C2)-FIND("-",C2)-1)
3、观察公司规模有2列scale和scale2,需要做合并,删减

复制代码
    # 查看城市对数据分析职位的需求
    tests.city.value_counts()
    #可以将数量少的归为‘其他’类
    tests['city']= tests['city'].replace(["郑州","厦门","重庆","苏州","佛山","天津","贵阳","昆明","南京","东莞","福州","常州","珠海",
                                "乌鲁木齐","石家庄"],"其他")
    tests.city.value_counts()
复制代码
    北京    227
    上海     48
    杭州     48
    深圳     39
    广州     39
    其他     23
    长沙     11
    成都      8
    武汉      6
    Name: city, dtype: int64
复制代码
    #查看各个城市对职位的需求;可以看出北京的需求量远远高于其他城市,其次是上海和杭州
    tests.city.value_counts().plot(kind='bar')
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0xedce908>
png
复制代码
    # 查看数据分析职位对学历的需求;可以看出数据分析职位所需人才大多在本科水平
    tests.education.value_counts()
    tests.education.value_counts().plot(kind='bar')
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0xf0454e0>
png
复制代码
    #工作经验和职位数量的关系;不做可视化,可以看出职位要求工作经验在3-5年的需求对多,其次是1-3年
    tests.experience.value_counts()
复制代码
    3-5年      210
    1-3年      159
    5-10年      46
    不限         34
    Name: experience, dtype: int64
复制代码
    #查看职位对phase
    tests.phase.value_counts()
复制代码
    不需要融资    97
    上市公司     88
    D轮及以上    81
    C轮       75
    B轮       49
    A轮       43
    未融资      11
    天使轮       5
    Name: phase, dtype: int64
复制代码
    # 平均薪资汇总统计
    tests.average_salary.describe()
复制代码
    count    449.000000
    mean      18.268374
    std        8.234619
    min        2.500000
    25%       12.500000
    50%       17.500000
    75%       22.500000
    max       75.000000
    Name: average_salary, dtype: float64
复制代码
    #做可视化分析,薪资的分布情况
    tests.average_salary.hist()
    #从图中可以看出薪资大多在10k-20k之间
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0xf09db38>
png
复制代码
    #对影响薪资水平的因素进行分析,采用箱线图,不同城市的薪资分布情况
    tests.boxplot(column='average_salary',by='city')
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0xf0ad550>
png
复制代码
    #不同工作年限的薪资的分布情况
    tests.boxplot(column='average_salary',by='experience')
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0x1012c4a8>
png
复制代码
    #不同学历的薪资分布情况
    tests.boxplot(column='average_salary',by='education')
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0x1021f438>
png
复制代码
    #不同城市的平均薪资
    pd.DataFrame(tests.groupby('city').average_salary.mean())
average_salary
city
上海 17.541667
其他 11.782609
北京 20.074890
广州 16.230769
成都 10.250000
杭州 17.947917
武汉 13.500000
深圳 20.205128
长沙 7.909091
复制代码
    test_city_mean = pd.DataFrame(tests.groupby('city').average_salary.mean())
    test_city_mean.plot(kind='bar')
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0x1031cfd0>
png
复制代码
    #不同学历对平均薪资的影响
    test_education_mean = pd.DataFrame(tests.groupby('education').average_salary.mean())
    test_education_mean.plot(kind='bar')
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0x103ae0f0>
png
复制代码
    #不同经验对平均薪资的影响
    test_experience_mean = pd.DataFrame(tests.groupby('experience').average_salary.mean())
    test_experience_mean.plot(kind='bar')
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0x10396b70>
png
复制代码
    #不同城市,不同经验对平均薪资的影响;可以看出,5-10年工作经验的平均薪资最高,其次是3-5年,得出结论,经验越高,工资水平越高。
    test_city_experience_mean = pd.DataFrame(tests.groupby(['city','experience']).average_salary.mean()).unstack()
    test_city_experience_mean.plot(kind='bar',figsize=(10,8))
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0x103ae710>
png
复制代码
    #不同城市,不同学历 对平均薪资的影响;可以看出,北上广深一线城市对于学历的要求大多在硕士和本科
    test_city_education_mean = pd.DataFrame(tests.groupby(["city","education"]).average_salary.mean()).unstack()
    test_city_education_mean.plot(kind='bar',figsize=(13,6))
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0x10417198>
png
复制代码
    test_city = tests[tests.city.isin(['上海','北京'])]
复制代码
    # 多维度分析,同一地区,不同学历对薪资的影响,拿北京和上海比较,可以看出,在相同学历背景下,北京比上海总体薪资水平要高。
    fig = plt.figure()
    test_city = tests[tests.city.isin(['上海','北京'])]
    test_city.boxplot(column='average_salary',by=['education','city'],figsize=(10,6))
    plt.show()
复制代码
    <Figure size 432x288 with 0 Axes>
在这里插入图片描述
复制代码
    # 再从另一个角度分析,同一地区,不同经验对薪资的影响,同样也是北京和上海;
    test_experience = tests[tests.city.isin(["北京","上海"])]
    test_experience.boxplot(column='average_salary',by=['experience','city'],figsize=(10,6))
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0x104bcda0>
在这里插入图片描述
复制代码
    #公司规模大小对职位的需求;可以看出,规模越大的公司对于数据分析职位需求越大。
    tests.scale.value_counts()
    tests.scale.value_counts().plot(kind='bar')
复制代码
    <matplotlib.axes._subplots.AxesSubplot at 0x107dd6a0>
png

全部评论 (0)

还没有任何评论哟~