基于Python|“數(shù)據(jù)分析崗位”招聘情況分析!

數(shù)據(jù)處理
數(shù)據(jù)分析
分析報(bào)告
import pandas as pdimport warningsimport numpy as npwarnings.simplefilter(action='ignore', category=FutureWarning)warnings.simplefilter(action='ignore', category=UserWarning)import matplotlib as mltimport matplotlib.pyplot as plt%matplotlib inline# 讀取txt格式的數(shù)據(jù)dataset = pd.read_table(r'C:/Users/Administrator/Desktop/recruits.txt',low_memory = False)dataset.info()# 全覽數(shù)據(jù)可以發(fā)現(xiàn):數(shù)據(jù)缺少字段名RangeIndex: 1193846 entries, 0 to 1193845Data columns (total 13 columns):940864 1193846 non-null int64UI 1193846 non-null object用戶界面(UI)設(shè)計(jì) 1193846 non-null object8001-10000 1193846 non-null object3-5 1193846 non-null object本科 1193846 non-null object全職 1193846 non-null object2017-11-15 1193846 non-null object1 1193846 non-null object杭州****技術(shù)有限公司 1193846 non-null object計(jì)算機(jī)軟件 1193690 non-null object20-99 1193669 non-null object杭州 1193801 non-null objectdtypes: int64(1), object(12)memory usage: 118.4+ MB# 自定義字段名data = pd.read_table(r'C:/Users/Administrator/Desktop/recruits.txt',header = None,index_col = '序號(hào)',low_memory = False,names =['序號(hào)','崗位職責(zé)','崗位名稱','薪資','工作時(shí)長(zhǎng)','學(xué)歷','職業(yè)類型','發(fā)布時(shí)間','招聘人數(shù)','公司名稱','所處行業(yè)','公司規(guī)模','工作地點(diǎn)'])data.head()

# 自定義字段名添加成功data.info()# resultInt64Index: 1193847 entries, 940864 to 926760Data columns (total 12 columns):崗位職責(zé) 1193847 non-null object崗位名稱 1193847 non-null object薪資 1193847 non-null object工作時(shí)長(zhǎng) 1193847 non-null object學(xué)歷 1193847 non-null object職業(yè)類型 1193847 non-null object發(fā)布時(shí)間 1193847 non-null object招聘人數(shù) 1193847 non-null object公司名稱 1193847 non-null object所處行業(yè) 1193691 non-null object公司規(guī)模 1193670 non-null object工作地點(diǎn) 1193802 non-null objectdtypes: object(12)memory usage: 118.4+ MBNone# 重置索引data = data.reset_index()data.tail()

# 獲取數(shù)據(jù)集的列名data.columns#?resultIndex(['崗位職責(zé)', '崗位名稱', '薪資', '工作時(shí)長(zhǎng)', '學(xué)歷', '職業(yè)類型', '發(fā)布時(shí)間', '招聘人數(shù)', '所處行業(yè)', '公司規(guī)模', '工作地點(diǎn)'],dtype='object')
# 轉(zhuǎn)換數(shù)據(jù)集,去掉序號(hào),去掉公司名稱(脫敏)data = data[['崗位職責(zé)', '崗位名稱', '薪資', '工作時(shí)長(zhǎng)', '學(xué)歷', '職業(yè)類型', '發(fā)布時(shí)間', '招聘人數(shù)','所處行業(yè)', '公司規(guī)模', '工作地點(diǎn)']]data.info()# resultdata = data[['崗位職責(zé)', '崗位名稱', '薪資', '工作時(shí)長(zhǎng)', '學(xué)歷', '職業(yè)類型', '發(fā)布時(shí)間', '招聘人數(shù)','所處行業(yè)', '公司規(guī)模', '工作地點(diǎn)']]data.info()RangeIndex: 1193847 entries, 0 to 1193846Data columns (total 11 columns):崗位職責(zé) 1193847 non-null object崗位名稱 1193847 non-null object薪資 1193847 non-null object工作時(shí)長(zhǎng) 1193847 non-null object學(xué)歷 1193847 non-null object職業(yè)類型 1193847 non-null object發(fā)布時(shí)間 1193847 non-null object招聘人數(shù) 1193847 non-null object所處行業(yè) 1193691 non-null object公司規(guī)模 1193670 non-null object工作地點(diǎn) 1193802 non-null objectdtypes: object(11)memory usage: 100.2+ MBdata.head(10)

# 查看數(shù)據(jù)集是否存在異常值print('最早發(fā)布時(shí)間:',data['發(fā)布時(shí)間'].unique().min(),',最晚發(fā)布時(shí)間:',data['發(fā)布時(shí)間'].unique().max())#?可以發(fā)現(xiàn):發(fā)布時(shí)間異常最早發(fā)布時(shí)間:1970-01-01 ,最晚發(fā)布時(shí)間:2017-11-23# 查看異常數(shù)據(jù)data[(data['發(fā)布時(shí)間']<'2017-01-01')]

# 僅保留17年及以后的招聘信息data = data[(data['發(fā)布時(shí)間']>='2017-01-01')]# 重復(fù)值統(tǒng)計(jì)data.duplicated().sum()# result35950# 去重data.drop_duplicates(inplace=True)# 再次查看數(shù)據(jù)集情況,發(fā)現(xiàn)存在空值data.info()# resultInt64Index: 1157827 entries, 0 to 1193846Data columns (total 11 columns):崗位職責(zé) 1157827 non-null object崗位名稱 1157827 non-null object薪資 1157827 non-null object工作時(shí)長(zhǎng) 1157827 non-null object學(xué)歷 1157827 non-null object職業(yè)類型 1157827 non-null object發(fā)布時(shí)間 1157827 non-null object招聘人數(shù) 1157827 non-null object所處行業(yè) 1157674 non-null object公司規(guī)模 1157667 non-null object工作地點(diǎn) 1157796 non-null objectdtypes: object(11)memory usage: 106.0+ MB# 空值處理:統(tǒng)計(jì)空值數(shù)量data.isnull().sum()# result崗位職責(zé) 0崗位名稱 0薪資 0工作時(shí)長(zhǎng) 0學(xué)歷 0職業(yè)類型 0發(fā)布時(shí)間 0招聘人數(shù) 0所處行業(yè) 153公司規(guī)模 160工作地點(diǎn) 31dtype: int64# 公司規(guī)模列空值較多,可具體查看data[data['公司規(guī)模'].isnull()]

# 刪除空值data.dropna(inplace=True)# 再次查看,發(fā)現(xiàn)所有數(shù)據(jù)都處理完畢data.info()# resultInt64Index: 1157647 entries, 0 to 1193846Data columns (total 11 columns):崗位職責(zé) 1157647 non-null object崗位名稱 1157647 non-null object薪資 1157647 non-null object工作時(shí)長(zhǎng) 1157647 non-null object學(xué)歷 1157647 non-null object職業(yè)類型 1157647 non-null object發(fā)布時(shí)間 1157647 non-null object招聘人數(shù) 1157647 non-null object所處行業(yè) 1157647 non-null object公司規(guī)模 1157647 non-null object工作地點(diǎn) 1157647 non-null objectdtypes: object(11)memory?usage:?106.0+?MB
# 僅選擇數(shù)據(jù)分析師崗位進(jìn)行分析,大家還可以進(jìn)行數(shù)據(jù)分析專員等分析data_da = data[data['崗位名稱']=='數(shù)據(jù)分析師'].copy() # 不加copy()容易警告:SettingWithCopyWarningdata_da[ data_da['招聘人數(shù)']=='若干'] # 為了分析的方便,去掉“若干”情況

# 數(shù)據(jù)處理,重新賦值data_da.loc[ data_da['招聘人數(shù)']=='若干','招聘人數(shù)'] = 0data_da['招聘人數(shù)'].value_counts()# result135313 95759492 93467224 43282427 1621014512 7830719 29201518 1415760 40225 116113 1Name: 招聘人數(shù), dtype: int64# 查看招聘人數(shù)data_da['招聘人數(shù)'] = data_da['招聘人數(shù)'].astype(int)grb = data_da.groupby(['工作地點(diǎn)']).agg({'崗位名稱':'count','招聘人數(shù)':sum}).sort_values(by = '崗位名稱',ascending = False).head(10)grb

# 繪圖說明不同城市對(duì)數(shù)據(jù)分析師的需求數(shù)量grb.plot(kind = 'bar',figsize=(10,5),fontsize=12)plt.legend(['崗位數(shù)量','招聘人數(shù)'])plt.xlabel('工作地點(diǎn)',fontsize=15)plt.show()

# 查看所處行業(yè)情況data['所處行業(yè)'].value_counts().head(10)# result互聯(lián)網(wǎng)/電子商務(wù) 267519計(jì)算機(jī)軟件 261188IT服務(wù)(系統(tǒng)/數(shù)據(jù)/維護(hù)) 95320教育/培訓(xùn)/院校 94988專業(yè)服務(wù)/咨詢(財(cái)會(huì)/法律/力資源等) 52931媒體/出版/影視/文化傳播 49300基金/證券/期貨/投資 32005電子技術(shù)/半導(dǎo)體/集成電路 28652房地產(chǎn)/建筑/建材/工程 25118通信/電信/網(wǎng)絡(luò)設(shè)備 24828Name: 所處行業(yè), dtype: int64# 篩選出北京地區(qū)互聯(lián)網(wǎng)公司數(shù)據(jù)分析師招聘數(shù)據(jù)subdata = data[data['所處行業(yè)'].isin(['互聯(lián)網(wǎng)/電子商務(wù)'])][(data['崗位名稱']=='數(shù)據(jù)分析師')&(data['工作地點(diǎn)']=='北京')]subdata.iloc[:20,:]

# 學(xué)歷因素subdata['學(xué)歷'].value_counts(normalize = True)# result本科 0.568910碩士 0.174679大專 0.142628不限 0.113782Name: 學(xué)歷, dtype: float64# 其他城市可能會(huì)用到-- subdata[subdata['學(xué)歷'].isin(['中專','中技'])]--?subdata.loc[(subdata['學(xué)歷']=='中專')|(subdata['學(xué)歷']=='中技'),'學(xué)歷']?=?'不限'# 繪圖說明數(shù)據(jù)分析師對(duì)學(xué)歷的要求subdata['學(xué)歷'].value_counts(normalize = True)plt.pie(subdata['學(xué)歷'].value_counts(normalize = True),labels = ['本科','碩士','大專','不限'],autopct='%.1f%%',startangle=180)plt.show()plt.close()

#?薪資情況subdata.groupby(['學(xué)歷','工作時(shí)長(zhǎng)'])[['薪資']].describe()


評(píng)論
圖片
表情
