首页 > 其他分享 >大数据分析-对拉勾网招聘信息的数据分析与挖掘

大数据分析-对拉勾网招聘信息的数据分析与挖掘

时间:2022-12-22 12:44:57浏览次数:57  
标签:数据分析 拉勾 招聘 list value item counts data opts

一,选题背景

我们学习Python到什么程度,就可以开始找工作了呢,大家都知道,实践是检验真理的唯一标准,那么学到什么程度可以找工作,当然得看市场的需求,毕竟企业招你来是工作的,而不是让你来带薪学习的。

所以,今天我们就试着爬取下拉钩上关于 Python 的招聘信息,来看看市场到底需要什么样的人才。

二,数据分析方案

1.本数据集的数据内容

  本数据集是一份拉勾网的部分招聘信息数据,含有10个字段。

 

字段  类型 解释
city 字符型 工作地点地图
industryField 字符型 行业分布
education 字符型 学历要求
workYear 字符型 工作经验
salary 字符型 薪资
skillLables 字符型 所需技能
companyLabelList 字符型 福利
firstType 字符型 第一类型
secondType 字符型 第二类型
thirdType 字符型 第三类型

 

 

 

 

 

 

 

 

 

 

 

二,数据分析及课程概述

1,对数据进行预处理,清洗

2,对数据进行挖掘与分析

三,数据分析

1.数据源,

利用爬虫工具后裔采集器爬取数据,

 

https://www.lagou.com/jobs/list_python?px=new&city=%E5%85%A8%E5%9B%BD

导入包

 1 #导入各种需要的库
 2 import numpy as np
 3 from pyecharts.charts import Bar
 4 from pyecharts.charts import Pie
 5 import pyecharts.options as opts
 6 from pyecharts.charts import WordCloud
 7 from pyecharts.globals import SymbolType
 8 from pyecharts.commons.utils import JsCode  
 9 import json
10 import pandas as pd
11 import matplotlib.pyplot as plt
12 import seaborn as sns
13 
14 plt.rcParams['font.sans-serif']=['SimHei']##中文乱码问题!
15 plt.rcParams['axes.unicode_minus']=False#横坐标负号显示问题!

导入数据

上面我们将获取到的 json 数据存储到了 data.txt 文件中,这不方便我们后续的数据分析操作。用 pandas 对数据做分析,所以需要做一下数据格式化。

 1 #加载数据
 2 def get_data():
 3     with open("data.txt",'rb') as f:
 4         data = []
 5         for line in f.readlines():
 6             result = json.loads(line)
 7             result_list = result['content']['positionResult']['result']
 8             for item in result_list:
 9                 dict = {
10                     'city': item['city'],
11                     'industryField': item['industryField'],
12                     'education': item['education'],
13                     'workYear': item['workYear'],
14                     'salary': item['salary'],
15                     'firstType': item['firstType'],
16                     'secondType': item['secondType'],
17                     'thirdType': item['thirdType'],
18                     # list
19                     'skillLables': ','.join(item['skillLables']),
20                     'companyLabelList': ','.join(item['companyLabelList'])
21                 }
22                 data.append(dict)
23         return data
1 #查看数据
2 data = get_data()
3 data = pd.DataFrame(data)
4 data.head(5)

 

2,数据清洗

在工程实践中,我们得到的数据会存在有缺失值、重复值等,在使用之前需要进行数据清洗。

1 #删除无效的行
2 data.drop(0, axis = 0, inplace=True)
3 data

1 #查找重复值
2 data.duplicated()

1 #查询空值
2 data[data.isnull().values==True].head()

1 #缺失值NaN
2 data.isna().head()

1 #describe查看统计信息
2 data.describe()

3,数据可视化

Top15 的城市数据

先来看看哪些城市的招聘需求最大。这里我们只取 Top15 的城市数据。

 1 # 城市图 Top15
 2 #统计每个城市出现的次数
 3 citys_value_counts = data['city'].value_counts()
 4 
 5 #获取前15个城市名称
 6 top = 15
 7 citys = list(citys_value_counts.head(top).index)  
 8 
 9 #获取前15城市出现的次数
10 city_counts = list(citys_value_counts.head(top))  
11 
12 bar = (
13     Bar()
14         .add_xaxis(citys)
15         .add_yaxis("", city_counts)
16         .set_global_opts(title_opts=opts.TitleOpts(title="城市招聘需求", subtitle="Top15 城市数据"))
17 )
18 bar.render_notebook()

全部城市

 1 # 城市图 所有城市
 2 c = (
 3     Pie()
 4     .add(
 5         "",
 6         [list(z) for z in zip(citys, city_counts)],
 7         radius=["40%", "55%"],
 8         label_opts=opts.LabelOpts(
 9             position="outside",
10             formatter="{a|{a}}{abg|}\n{hr|}\n {b|{b}: }{c}  {per|{d}%}  ",
11             background_color="#eee",
12             border_color="#aaa",
13             border_width=1,
14             border_radius=4,
15             rich={
16                 "a": {"color": "#999", "lineHeight": 22, "align": "center"},
17                 "abg": {
18                     "backgroundColor": "#e3e3e3",
19                     "width": "100%",
20                     "align": "right",
21                     "height": 22,
22                     "borderRadius": [4, 4, 0, 0],
23                 },
24                 "hr": {
25                     "borderColor": "#aaa",
26                     "width": "100%",
27                     "borderWidth": 0.5,
28                     "height": 0,
29                 },
30                 "b": {"fontSize": 16, "lineHeight": 33},
31                 "per": {
32                     "color": "#eee",
33                     "backgroundColor": "#334455",
34                     "padding": [2, 4],
35                     "borderRadius": 2,
36                 },
37             },
38         ),
39     )
40     .set_global_opts(legend_opts=opts.LegendOpts(is_show=False),title_opts=opts.TitleOpts(title="城市招聘需求", subtitle="所有城市数据"))
41 )
42 c.render_notebook()

由上图可以看出,北京基本占据了四分之一还多的招聘量,其次是上海,深圳,杭州,单单从需求量来说,四个一线城市中广州被杭州所代替。

这也就从侧面说明了我们为啥要去一线城市发展了

 

行业信息

这些招聘方都属于哪些行业。因为行业数据不是非常规整,所以需要单独对每一条记录按照 , 作下切割。

 1 # 行业
 2 industrys = list(data['industryField'])
 3 industry_list = [i for item in industrys for i in item.split(',')]
 4 
 5 industry_series = pd.Series(data=industry_list)
 6 industry_value_counts = industry_series.value_counts()
 7 
 8 industrys = list(industry_value_counts.head(top).index)
 9 industry_counts = list(industry_value_counts.head(top))
10 
11 pie = (
12     Pie()
13         .add("", [list(z) for z in zip(industrys, industry_counts)])
14         .set_global_opts(title_opts=opts.TitleOpts(title="招聘方所属行业"))
15         .set_global_opts(legend_opts=opts.LegendOpts(is_show=True,pos_left=True))
16         .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
17 )
18 pie.render_notebook()

移动互联网行业占据了四分之一还多的需求量,这跟我们的认识的大环境是相符合的

 

学历情况

接下来我们分析学历占比情况

 1 # 学历
 2 #统计每个学历出现的次数
 3 eduction_value_counts = data['education'].value_counts()  
 4 
 5 #获取所有学历
 6 eduction = list(eduction_value_counts.index)  
 7 
 8 #获取所有学历出现的次数
 9 eduction_counts = list(eduction_value_counts)  
10 
11 pie = (
12     (
13         Pie()
14         .add(
15             series_name="学历",
16             data_pair=[list(z) for z in zip(eduction, eduction_counts)],
17             radius=["50%", "70%"],
18             label_opts=opts.LabelOpts(is_show=False, position="center"),
19         )
20         .set_global_opts(
21             legend_opts=opts.LegendOpts(pos_left="legft", orient="vertical")
22         )
23         .set_series_opts(
24             tooltip_opts=opts.TooltipOpts(
25                 trigger="item", formatter="{a} <br/>{b}: {c} ({d}%)"
26             ),
27             label_opts=opts.LabelOpts(formatter="{b}: {c}")
28         )
29     )
30 )
31 pie.render_notebook()

工作年限分析

3-5年的中级工程师需求最多,其次是 1-3 年的初级工程师。

其实这也是符合市场规律的,这是因为高级工程师换工作频率远远低于初中级,且一个公司对高级工程师的需求量是远远低于初中级工程师的。

但是发现1年以下的招的非常少,所以很多自学的人入行难!

 1 # 工作年限
 2 #对工作年限进行次数统计
 3 work_year_value_counts = data['workYear'].value_counts()  
 4 
 5 #获取所有工作年限
 6 work_year = list(work_year_value_counts.index)
 7 
 8 #获取所有工作年限出现的次数
 9 work_year_counts = list(work_year_value_counts)  
10 
11 
12 bar = (
13     Bar()
14     .add_xaxis(work_year)
15     .add_yaxis("",work_year_counts, category_gap="60%")
16     .set_series_opts(
17         itemstyle_opts={
18             "normal": {
19                 "color": JsCode(
20                     """new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
21                 offset: 0,
22                 color: 'rgba(0, 244, 255, 1)'
23             }, {
24                 offset: 1,
25                 color: 'rgba(0, 77, 167, 1)'
26             }], false)"""
27                 ),
28                 "barBorderRadius": [30, 30, 30, 30],
29                 "shadowColor": "rgb(0, 160, 221)",
30             }
31         }
32     )
33     .set_global_opts(title_opts=opts.TitleOpts(title="工作年限"))
34 )
35 bar.render_notebook()

薪资条件

看看各大公司给出的薪资条件

 1 # 薪资
 2 #获取每个工资范围及对应的数量
 3 salary_value_counts = data['salary'].value_counts()  
 4 
 5  #获取所有工资范围
 6 salary = list(salary_value_counts.head(top).index) 
 7 
 8 #获取所以工资范围对应的数量
 9 salary_counts = list(salary_value_counts.head(top))   
10 
11 #柱状图
12 bar = (
13     Bar()
14         .add_xaxis(salary)
15         .add_yaxis("", salary_counts)
16         .set_global_opts(xaxis_opts=opts.AxisOpts(name_rotate=0, name="薪资", axislabel_opts={"rotate": 45}))
17         .set_global_opts(title_opts=opts.TitleOpts(title="薪资"))
18 )
19 bar.render_notebook()

 

第一类型

 1 # firstType
 2 industrys = list(data['firstType'])
 3 industry_list = [i for item in industrys for i in item.split(',')]
 4 
 5 industry_series = pd.Series(data=industry_list)
 6 industry_value_counts = industry_series.value_counts()
 7 
 8 industrys = list(industry_value_counts.head(top).index)
 9 industry_counts = list(industry_value_counts.head(top))
10 
11 pie = (
12     Pie()
13         .add("", [list(z) for z in zip(industrys, industry_counts)])
14         .set_global_opts(title_opts=opts.TitleOpts(title="firstType"))
15         .set_global_opts(legend_opts=opts.LegendOpts(is_show=True,pos_left=True))
16         .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
17 )
18 pie.render_notebook()

第二类型

 1 #先按逗号进行切分,然后转换为Series类型的数据
 2 word_data = data['secondType'].str.split(',').apply(pd.Series)  
 3  #删除空值
 4 word_data = word_data.replace(np.nan, '') 
 5 #将数据转换为字符串类型
 6 text = word_data.to_string(header=False, index=False)  
 7 #去除字符串里面的空白字符,存入skills列表
 8 skills = text.split()  
 9 skill_count = {}  
10 #统计每个关键词出现的次数
11 for item in skills:
12    if item in skill_count: 
13       skill_count[item]+=1
14    else:
15       skill_count[item]=1
16 skill = skill_count.keys()
17 skill_value = skill_count.values()
 1 result = [list(z) for z in zip(skill, skill_value)]
 2 c = (
 3 (
 4     WordCloud()
 5     .add(series_name="工作", data_pair=result, word_size_range=[20, 60])
 6     .set_global_opts(
 7         title_opts=opts.TitleOpts(
 8             title="工作性质", title_textstyle_opts=opts.TextStyleOpts(font_size=23)
 9         ),
10         tooltip_opts=opts.TooltipOpts(is_show=True),
11     )
12 ))
13 c.render_notebook()

第三类型

 1 #统计thirdType中每个类型出现的次数
 2 citys_value_counts = data['thirdType'].value_counts()  
 3 
 4 citys = list(citys_value_counts.head(top).index)  
 5 
 6 #获取前15城市出现的次数
 7 city_counts = list(citys_value_counts.head(top))  
 8 
 9 bar = (
10     Bar()
11         .add_xaxis(citys)
12         .add_yaxis("", city_counts)
13         .set_global_opts(title_opts=opts.TitleOpts(title="招聘技能需求", subtitle="Top15 数据"))
14    
15 )
16 bar.render_notebook()

分析技能情况

 1 #先按逗号进行切分,然后转换为Series类型的数据
 2 word_data = data['skillLables'].str.split(',').apply(pd.Series)  
 3  #删除空值
 4 word_data = word_data.replace(np.nan, '') 
 5 #将数据转换为字符串类型
 6 text = word_data.to_string(header=False, index=False)  
 7 #去除字符串里面的空白字符,存入skills列表
 8 skills = text.split()  
 9 skill_count = {}  
10 #统计每个关键词出现的次数
11 for item in skills:
12    if item in skill_count: 
13       skill_count[item]+=1
14    else:
15       skill_count[item]=1
16 skill = skill_count.keys()
17 skill_value = skill_count.values()
 1 result = [list(z) for z in zip(skill, skill_value)]
 2 c = (
 3 (
 4     WordCloud()
 5     .add(series_name="技能点", data_pair=result, word_size_range=[20, 60])
 6     .set_global_opts(
 7         title_opts=opts.TitleOpts(
 8             title="技能", title_textstyle_opts=opts.TextStyleOpts(font_size=23)
 9         ),
10         tooltip_opts=opts.TooltipOpts(is_show=True),
11     )
12 ))
13 c.render_notebook()

福利待遇

年底双薪、绩效奖金、扁平化管理。都是大家所熟知的福利,其中扁平化管理是互联网公司的特色。不像国企或实体企业,上下级观念会比较重

 1 #先按逗号进行切分,然后转换为Series类型的数据,操作基本一样
 2 word_data = data['companyLabelList'].str.split(',').apply(pd.Series)  
 3 #删除空值
 4 word_data = word_data.replace(np.nan, '')  
 5 #将数据转换为字符串类型
 6 text = word_data.to_string(header=False, index=False)  
 7 #去除字符串里面的空白字符,存入skills列表
 8 Welfares = text.split()  
 9 Welfarecount = {}
10 #统计每个关键字出现的次数
11 for item in Welfares:
12    if item in Welfarecount: 
13       Welfarecount[item]+=1
14    else:
15       Welfarecount[item]=1
16 Welfare = Welfarecount.keys()
17 Welfare_value = Welfarecount.values()
1 result = [list(z) for z in zip(Welfare, Welfare_value)]
2 c = (
3     WordCloud()
4     .add("", result, word_size_range=[20, 100], shape=SymbolType.DIAMOND)
5     .set_global_opts(title_opts=opts.TitleOpts(title="公司福利"))
6 )
7 c.render_notebook()

四,完整代码

  1 #导入各种需要的库
  2 import numpy as np
  3 from pyecharts.charts import Bar
  4 from pyecharts.charts import Pie
  5 import pyecharts.options as opts
  6 from pyecharts.charts import WordCloud
  7 from pyecharts.globals import SymbolType
  8 from pyecharts.commons.utils import JsCode  
  9 import json
 10 import pandas as pd
 11 import matplotlib.pyplot as plt
 12 import seaborn as sns
 13 
 14 plt.rcParams['font.sans-serif']=['SimHei']##中文乱码问题!
 15 plt.rcParams['axes.unicode_minus']=False#横坐标负号显示问题!
 16 
 17 #加载数据
 18 def get_data():
 19     with open("data.txt",'rb') as f:
 20         data = []
 21         for line in f.readlines():
 22             result = json.loads(line)
 23             result_list = result['content']['positionResult']['result']
 24             for item in result_list:
 25                 dict = {
 26                     'city': item['city'],
 27                     'industryField': item['industryField'],
 28                     'education': item['education'],
 29                     'workYear': item['workYear'],
 30                     'salary': item['salary'],
 31                     'firstType': item['firstType'],
 32                     'secondType': item['secondType'],
 33                     'thirdType': item['thirdType'],
 34                     # list
 35                     'skillLables': ','.join(item['skillLables']),
 36                     'companyLabelList': ','.join(item['companyLabelList'])
 37                 }
 38                 data.append(dict)
 39         return data
 40 
 41 
 42 #查看数据
 43 data = get_data()
 44 data = pd.DataFrame(data)
 45 data.head(5)
 46 
 47 #删除无效的行
 48 data.drop(0, axis = 0, inplace=True)
 49 data
 50 
 51 #查找重复值
 52 data.duplicated()
 53 
 54 #查询空值
 55 data[data.isnull().values==True].head()
 56 
 57 #缺失值NaN
 58 data.isna().head()
 59 
 60 #describe查看统计信息
 61 data.describe()
 62 
 63 # 城市图 Top15
 64 #统计每个城市出现的次数
 65 citys_value_counts = data['city'].value_counts()
 66 #获取前15个城市名称
 67 top = 15
 68 citys = list(citys_value_counts.head(top).index)  
 69 #获取前15城市出现的次数
 70 city_counts = list(citys_value_counts.head(top))  
 71 
 72 bar = (
 73     Bar()
 74         .add_xaxis(citys)
 75         .add_yaxis("", city_counts)
 76         .set_global_opts(title_opts=opts.TitleOpts(title="城市招聘需求", subtitle="Top15 城市数据"))
 77 )
 78 bar.render_notebook()
 79 
 80 # 城市图 所有城市
 81 c = (
 82     Pie()
 83     .add(
 84         "",
 85         [list(z) for z in zip(citys, city_counts)],
 86         radius=["40%", "55%"],
 87         label_opts=opts.LabelOpts(
 88             position="outside",
 89             formatter="{a|{a}}{abg|}\n{hr|}\n {b|{b}: }{c}  {per|{d}%}  ",
 90             background_color="#eee",
 91             border_color="#aaa",
 92             border_width=1,
 93             border_radius=4,
 94             rich={
 95                 "a": {"color": "#999", "lineHeight": 22, "align": "center"},
 96                 "abg": {
 97                     "backgroundColor": "#e3e3e3",
 98                     "width": "100%",
 99                     "align": "right",
100                     "height": 22,
101                     "borderRadius": [4, 4, 0, 0],
102                 },
103                 "hr": {
104                     "borderColor": "#aaa",
105                     "width": "100%",
106                     "borderWidth": 0.5,
107                     "height": 0,
108                 },
109                 "b": {"fontSize": 16, "lineHeight": 33},
110                 "per": {
111                     "color": "#eee",
112                     "backgroundColor": "#334455",
113                     "padding": [2, 4],
114                     "borderRadius": 2,
115                 },
116             },
117         ),
118     )
119     .set_global_opts(legend_opts=opts.LegendOpts(is_show=False),title_opts=opts.TitleOpts(title="城市招聘需求", subtitle="所有城市数据"))
120 )
121 c.render_notebook()
122 
123 # 行业
124 industrys = list(data['industryField'])
125 industry_list = [i for item in industrys for i in item.split(',')]
126 
127 industry_series = pd.Series(data=industry_list)
128 industry_value_counts = industry_series.value_counts()
129 
130 industrys = list(industry_value_counts.head(top).index)
131 industry_counts = list(industry_value_counts.head(top))
132 
133 pie = (
134     Pie()
135         .add("", [list(z) for z in zip(industrys, industry_counts)])
136         .set_global_opts(title_opts=opts.TitleOpts(title="招聘方所属行业"))
137         .set_global_opts(legend_opts=opts.LegendOpts(is_show=True,pos_left=True))
138         .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
139 )
140 pie.render_notebook()
141 
142 # 学历
143 #统计每个学历出现的次数
144 eduction_value_counts = data['education'].value_counts()  
145 
146 #获取所有学历
147 eduction = list(eduction_value_counts.index)  
148 
149 #获取所有学历出现的次数
150 eduction_counts = list(eduction_value_counts)  
151 
152 pie = (
153     (
154         Pie()
155         .add(
156             series_name="学历",
157             data_pair=[list(z) for z in zip(eduction, eduction_counts)],
158             radius=["50%", "70%"],
159             label_opts=opts.LabelOpts(is_show=False, position="center"),
160         )
161         .set_global_opts(
162             legend_opts=opts.LegendOpts(pos_left="legft", orient="vertical")
163         )
164         .set_series_opts(
165             tooltip_opts=opts.TooltipOpts(
166                 trigger="item", formatter="{a} <br/>{b}: {c} ({d}%)"
167             ),
168             label_opts=opts.LabelOpts(formatter="{b}: {c}")
169         )
170     )
171 )
172 pie.render_notebook()
173 
174 # 工作年限
175 #对工作年限进行次数统计
176 work_year_value_counts = data['workYear'].value_counts()  
177 
178 #获取所有工作年限
179 work_year = list(work_year_value_counts.index)
180 
181 #获取所有工作年限出现的次数
182 work_year_counts = list(work_year_value_counts)  
183 
184 
185 bar = (
186     Bar()
187     .add_xaxis(work_year)
188     .add_yaxis("",work_year_counts, category_gap="60%")
189     .set_series_opts(
190         itemstyle_opts={
191             "normal": {
192                 "color": JsCode(
193                     """new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
194                 offset: 0,
195                 color: 'rgba(0, 244, 255, 1)'
196             }, {
197                 offset: 1,
198                 color: 'rgba(0, 77, 167, 1)'
199             }], false)"""
200                 ),
201                 "barBorderRadius": [30, 30, 30, 30],
202                 "shadowColor": "rgb(0, 160, 221)",
203             }
204         }
205     )
206     .set_global_opts(title_opts=opts.TitleOpts(title="工作年限"))
207 )
208 bar.render_notebook()
209 
210 # 薪资
211 #获取每个工资范围及对应的数量
212 salary_value_counts = data['salary'].value_counts()  
213 
214  #获取所有工资范围
215 salary = list(salary_value_counts.head(top).index) 
216 
217 #获取所以工资范围对应的数量
218 salary_counts = list(salary_value_counts.head(top))   
219 
220 #柱状图
221 bar = (
222     Bar()
223         .add_xaxis(salary)
224         .add_yaxis("", salary_counts)
225         .set_global_opts(xaxis_opts=opts.AxisOpts(name_rotate=0, name="薪资", axislabel_opts={"rotate": 45}))
226         .set_global_opts(title_opts=opts.TitleOpts(title="薪资"))
227 )
228 bar.render_notebook()
229 
230 # firstType
231 industrys = list(data['firstType'])
232 industry_list = [i for item in industrys for i in item.split(',')]
233 
234 industry_series = pd.Series(data=industry_list)
235 industry_value_counts = industry_series.value_counts()
236 
237 industrys = list(industry_value_counts.head(top).index)
238 industry_counts = list(industry_value_counts.head(top))
239 
240 pie = (
241     Pie()
242         .add("", [list(z) for z in zip(industrys, industry_counts)])
243         .set_global_opts(title_opts=opts.TitleOpts(title="firstType"))
244         .set_global_opts(legend_opts=opts.LegendOpts(is_show=True,pos_left=True))
245         .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
246 )
247 pie.render_notebook()
248 
249 
250 #先按逗号进行切分,然后转换为Series类型的数据
251 word_data = data['secondType'].str.split(',').apply(pd.Series)  
252  #删除空值
253 word_data = word_data.replace(np.nan, '') 
254 #将数据转换为字符串类型
255 text = word_data.to_string(header=False, index=False)  
256 #去除字符串里面的空白字符,存入skills列表
257 skills = text.split()  
258 skill_count = {}  
259 #统计每个关键词出现的次数
260 for item in skills:
261    if item in skill_count: 
262       skill_count[item]+=1
263    else:
264       skill_count[item]=1
265 skill = skill_count.keys()
266 skill_value = skill_count.values()
267 
268 result = [list(z) for z in zip(skill, skill_value)]
269 c = (
270 (
271     WordCloud()
272     .add(series_name="工作", data_pair=result, word_size_range=[20, 60])
273     .set_global_opts(
274         title_opts=opts.TitleOpts(
275             title="工作性质", title_textstyle_opts=opts.TextStyleOpts(font_size=23)
276         ),
277         tooltip_opts=opts.TooltipOpts(is_show=True),
278     )
279 ))
280 c.render_notebook()
281 
282 
283 #统计thirdType中每个类型出现的次数
284 citys_value_counts = data['thirdType'].value_counts()  
285 
286 citys = list(citys_value_counts.head(top).index)  
287 
288 #获取前15城市出现的次数
289 city_counts = list(citys_value_counts.head(top))  
290 
291 bar = (
292     Bar()
293         .add_xaxis(citys)
294         .add_yaxis("", city_counts)
295         .set_global_opts(title_opts=opts.TitleOpts(title="招聘技能需求", subtitle="Top15 数据"))
296    
297 )
298 bar.render_notebook()
299 
300 
301 word_data = data['skillLables'].str.split(',').apply(pd.Series)  
302  #删除空值
303 word_data = word_data.replace(np.nan, '') 
304 #将数据转换为字符串类型
305 text = word_data.to_string(header=False, index=False)  
306 #去除字符串里面的空白字符,存入skills列表
307 skills = text.split()  
308 skill_count = {}  
309 #统计每个关键词出现的次数
310 for item in skills:
311    if item in skill_count: 
312       skill_count[item]+=1
313    else:
314       skill_count[item]=1
315 skill = skill_count.keys()
316 skill_value = skill_count.values()
317 
318 result = [list(z) for z in zip(skill, skill_value)]
319 c = (
320 (
321     WordCloud()
322     .add(series_name="技能点", data_pair=result, word_size_range=[20, 60])
323     .set_global_opts(
324         title_opts=opts.TitleOpts(
325             title="技能", title_textstyle_opts=opts.TextStyleOpts(font_size=23)
326         ),
327         tooltip_opts=opts.TooltipOpts(is_show=True),
328     )
329 ))
330 c.render_notebook()
331 
332 
333 #先按逗号进行切分,然后转换为Series类型的数据,操作基本一样
334 word_data = data['companyLabelList'].str.split(',').apply(pd.Series)  
335 #删除空值
336 word_data = word_data.replace(np.nan, '')  
337 #将数据转换为字符串类型
338 text = word_data.to_string(header=False, index=False)  
339 #去除字符串里面的空白字符,存入skills列表
340 Welfares = text.split()  
341 Welfarecount = {}
342 #统计每个关键字出现的次数
343 for item in Welfares:
344    if item in Welfarecount: 
345       Welfarecount[item]+=1
346    else:
347       Welfarecount[item]=1
348 Welfare = Welfarecount.keys()
349 Welfare_value = Welfarecount.values()
350 
351 result = [list(z) for z in zip(Welfare, Welfare_value)]
352 c = (
353     WordCloud()
354     .add("", result, word_size_range=[20, 100], shape=SymbolType.DIAMOND)
355     .set_global_opts(title_opts=opts.TitleOpts(title="公司福利"))
356 )
357 c.render_notebook()

 

五,总结

通过选取拉勾网关于 Python 的招聘数据,对这批数据分析之后得出如下结论:

关于学历你最好是本科毕业,市场对 1-5 年工作经验的工程师需求量比较大,需求量最大的城市是北上深杭,需求量最多的行业仍然是移动互联网,而且大多数公司都够给到不错的薪酬待遇。如果你学历比较低,想要拿到高薪,需要有过硬的技能。

标签:数据分析,拉勾,招聘,list,value,item,counts,data,opts
From: https://www.cnblogs.com/zhaowuxing/p/16998006.html

相关文章