You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
2.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import pandas as pd
# 读取数据
data = pd.read_csv("智联卓聘.csv")
# 将城市这一列的所有是省-市的改为省
for i in data.index:
if '-' in data.loc[i,'城市']:
data.loc[i,'城市'] = data.loc[i,'城市'].split('-')[0]
data.to_csv("处理好城市后的数据.csv")
# 将公司类型这一列非公司类型的用无来代替
# 首先将所有的类型筛选出来
type = data["公司类型"].drop_duplicates().tolist()
li = ['民营', '外商独资', '其它','股份制企业', '上市公司', '事业单位', '国企','合资','国家机关', '港澳台公司']
data['公司类型']=data['公司类型'].astype(str)
for i in data.index:
if data.loc[i,'公司类型'] not in li:
data.loc[i,'公司类型'] = data.loc[i,'公司类型'].replace(data.loc[i,'公司类型'],'')
data = data.drop(data[data['公司类型']==''].index)
data = data.drop(data[data['公司规模']=='民营'].index)
data.to_csv("处理好公司类型和规模后的数据.csv")
# 将招聘公司和职位名称那一列中有...的...删除
data['招聘公司']=data['招聘公司'].astype(str)
for i in data.index:
if '...' in data.loc[i,'招聘公司']:
data.loc[i, '招聘公司'] = data.loc[i,'招聘公司'].replace('...','')
if '...' in data.loc[i,'职位名称']:
data.loc[i, '职位名称'] = data.loc[i,'职位名称'].replace('...','')
data.to_csv("处理好...后的数据.csv")
# 首先将这一列数据的名称改为年薪
# 因为工资那一列有很多都是xx-xx万为了在后续画图中方便这种格式的一律统一成前面的那个数
index = ["职位名称","年薪(万)","学历要求","工作经验","招聘公司","公司类型","公司规模","城市","行业"]
data.columns = index
for i in data.index:
if '-' in data.loc[i,'年薪(万)']:
data.loc[i,'年薪(万)'] = data.loc[i,'年薪(万)'].split('-')[0]
data = data.drop(data[data['年薪(万)']=='面议'].index)
data.to_csv("处理好工资之后的数据.csv")
# 将学历要求为硕士和博士的行删除
# d1 =data.drop(data[data['学历要求']=="硕士"].index,inplace=True)
# d2 =d1.drop(data[data['学历要求']=="博士"].index)
# d1.to_csv("最新数据.csv")
# print(d2.head())