數(shù)據(jù)分析歷屆諾貝爾獎~

作者&來源?|?k同學啊
最近,諾貝獎得主引起了大家的熱議,我用數(shù)據(jù)分析了一下歷年的諾貝爾獎得主情況,分享給大家~

注:圖片取自B站
“諾貝爾獎(瑞典語:Nobel priset,英語:Nobel Prize):是指根據(jù)諾貝爾1895年的遺囑而設立的五個獎項,包括:
”物理學獎、化學獎、和平獎、生理學或醫(yī)學獎和文學獎。旨在表彰在物理學、化學、和平、生理學或醫(yī)學以及文學上對社會做出卓越貢獻,或做出杰出研究、發(fā)明以及實驗的人士。以及瑞典中央銀行1968年設立的諾貝爾經(jīng)濟學獎,用于表彰在經(jīng)濟學領域杰出貢獻的人。 諾貝爾獎歷經(jīng)百年,時至今日,諾貝爾獎一直都被視為各領域最重要的榮譽之一。
歷年諾貝爾獎得主統(tǒng)計分析
????一、導入數(shù)據(jù)
????二、獲獎人性別分布統(tǒng)計
????三、各國獲獎人數(shù)統(tǒng)計
????四、各領域獲獎人數(shù)比例統(tǒng)計
????五、各領域獲獎人數(shù)統(tǒng)計-國家排名
????????1. 生理學獎獲獎人數(shù)top10國家
????????2. 物理學獎獲獎人數(shù)top10國家
????????3. 化學獎獲獎人數(shù)top10國家
????????4. 文學獎獲獎人數(shù)top10國家
????????5. 經(jīng)濟學獎獲獎人數(shù)top10國家
????????6. 和平獎獲獎人數(shù)top10國家
????六、獲獎者平均年齡統(tǒng)計
一、導入數(shù)據(jù)
#獲取獲獎信息數(shù)據(jù)
import?pandas?as?pd
data_date???=?pd.read_csv('nobel_prizes_by_date.csv',encoding?=?'ISO-8859-1')
data_winner?=?pd.read_csv('nobel_prize_by_winner.csv',encoding?=?'ISO-8859-1')
data_winner.head()
二、獲獎人性別分布統(tǒng)計
#去重后獲獎者總人數(shù)
data.id.nunique()
輸出:901
def?make_autopct(values):
????def?my_autopct(pct):
????????total?=?sum(values)
????????val?=?int(round(pct*total/100.0))
????????#?同時顯示數(shù)值和占比的餅圖
????????return?'{p:.2f}%??({v:d}人)'.format(p=pct,v=val)
????return?my_autopct
#?長8英寸?寬6英寸,該窗口的分辨率為80
plt.figure(figsize=(8,6),?dpi=?80)
labels?=?'男','女','組織'
explode?=?(0,0,0)??????????????????????????????#將某一塊分割出來,值越大分割出的間隙越大
colors?=?['yellowgreen','lightskyblue','yellow']?
patches,text1,text2?=?plt.pie([male,female,org],
??????????????????????explode=explode,
??????????????????????labels=labels,
??????????????????????colors=colors,
??????????????????????labeldistance?=?1.1,???????????????????????#標簽距圓心半徑倍距離
??????????????????????autopct?=?make_autopct([male,female,org]),?
??????????????????????shadow?=?True,?????????????????????????????#陰影設置
??????????????????????startangle?=30,????????????????????????????#逆時針起始角度設置
??????????????????????pctdistance?=?0.7)??
plt.title('獲獎者男女比例',fontsize=19)
plt.legend()
plt.show()
三、各國獲獎人數(shù)統(tǒng)計
#實例化Pie類
pie?=?Pie(init_opts=opts.InitOpts(width='800px',height='550px'))
#添加數(shù)據(jù),設置餅圖半徑
pie.add('',[list(z)?for?z?in?zip(data_cou.head(15).index.tolist(),?data_cou.head(15).values.tolist())],
????radius=['40%','65%'],
????rosetype='radius'
????)
#設置全局配置項
pie.set_global_opts(title_opts=opts.TitleOpts(title=''),
???????????????????legend_opts=opts.LegendOpts(is_show=True))
#玫瑰圖展示
pie.render_notebook()
四、各領域獲獎人數(shù)比例統(tǒng)計
#?長16英寸?寬8英寸,該窗口的分辨率為80
plt.figure(figsize=(16,8),?dpi=?80)
def?make_autopct(values):
????def?my_autopct(pct):
????????total?=?sum(values)
????????val?=?int(round(pct*total/100.0))
????????#?同時顯示數(shù)值和占比的餅圖
????????return?'{p:.2f}%??({v:d}人)'.format(p=pct,v=val)
????return?my_autopct
patches,l_text,p_text?=?plt.pie(data_cate.values,
????????????????????????????????labeldistance?=?1.1,
????????????????????????????????labels=data_cate.index,
????????????????????????????????startangle?=?60,
????????????????????????????????pctdistance?=?0.7,
????????????????????????????????autopct=make_autopct(data_cate.values))
for?t?in?l_text:
????t.set_size(12)
for?t?in?p_text:
????t.set_size(12)
????
plt.title('各領域獲獎人數(shù)',fontsize=15)
plt.legend(loc=2)
plt.show()
五、各領域獲獎人數(shù)統(tǒng)計-國家排名
1. 生理學獎獲獎人數(shù)top10國家
#實例化Pie類
pie?=?Pie(init_opts=opts.InitOpts(width='800px',height='550px'))
#添加數(shù)據(jù),設置餅圖半徑
pie.add('',[list(z)?for?z?in?zip(data_med.head(10).index.tolist(),?data_med.head(10).values.tolist())],
????radius=['30%','60%'],
????rosetype='radius'
????)
#設置全局配置項
pie.set_global_opts(title_opts=opts.TitleOpts(title=''),
???????????????????legend_opts=opts.LegendOpts(is_show=True))
#玫瑰圖展示
pie.render_notebook()??
2. 物理學獎獲獎人數(shù)top10國家
#實例化Pie類
pie?=?Pie(init_opts=opts.InitOpts(width='800px',height='550px'))
#添加數(shù)據(jù),設置餅圖半徑
pie.add('',[list(z)?for?z?in?zip(data_phy.head(10).index.tolist(),?data_phy.head(10).values.tolist())],
????radius=['30%','60%'],
????rosetype='radius'
????)
#設置全局配置項
pie.set_global_opts(title_opts=opts.TitleOpts(title=''),
???????????????????legend_opts=opts.LegendOpts(is_show=True))
#玫瑰圖展示
pie.render_notebook()??
3. 化學獎獲獎人數(shù)top10國家
#實例化Pie類
pie?=?Pie(init_opts=opts.InitOpts(width='800px',height='550px'))
#添加數(shù)據(jù),設置餅圖半徑
pie.add('',[list(z)?for?z?in?zip(data_che.head(10).index.tolist(),?data_che.head(10).values.tolist())],
????radius=['30%','60%'],
????rosetype='radius'
????)
#設置全局配置項
pie.set_global_opts(title_opts=opts.TitleOpts(title=''),
???????????????????legend_opts=opts.LegendOpts(is_show=True))
#玫瑰圖展示
pie.render_notebook()??
4. 文學獎獲獎人數(shù)top10國家
#實例化Pie類
pie?=?Pie(init_opts=opts.InitOpts(width='800px',height='550px'))
#添加數(shù)據(jù),設置餅圖半徑
pie.add('',[list(z)?for?z?in?zip(data_lit.head(10).index.tolist(),?data_lit.head(10).values.tolist())],
????radius=['30%','60%'],
????rosetype='radius'
????)
#設置全局配置項
pie.set_global_opts(title_opts=opts.TitleOpts(title=''),
???????????????????legend_opts=opts.LegendOpts(is_show=True))
#玫瑰圖展示
pie.render_notebook()??
5. 經(jīng)濟學獎獲獎人數(shù)top10國家
#實例化Pie類
pie?=?Pie(init_opts=opts.InitOpts(width='800px',height='550px'))
#添加數(shù)據(jù),設置餅圖半徑
pie.add('',[list(z)?for?z?in?zip(data_eco.head(10).index.tolist(),?data_eco.head(10).values.tolist())],
????radius=['45%','75%'],
????rosetype='radius'
????)
#設置全局配置項
pie.set_global_opts(title_opts=opts.TitleOpts(title=''),
???????????????????legend_opts=opts.LegendOpts(is_show=True))
#玫瑰圖展示
pie.render_notebook()??
6. 和平獎獲獎人數(shù)top10國家
#實例化Pie類
pie?=?Pie(init_opts=opts.InitOpts(width='800px',height='550px'))
#添加數(shù)據(jù),設置餅圖半徑
pie.add('',[list(z)?for?z?in?zip(data_pea.head(10).index.tolist(),?data_pea.head(10).values.tolist())],
????radius=['30%','60%'],
????rosetype='radius'
????)
#設置全局配置項
pie.set_global_opts(title_opts=opts.TitleOpts(title=''),
???????????????????legend_opts=opts.LegendOpts(is_show=True))
#玫瑰圖展示
pie.render_notebook()??
六、獲獎者平均年齡統(tǒng)計
df.plot(kind='bar',figsize=(10,6))
plt.title('各領域獲獎者獲獎年齡分布',fontsize=17)
plt.ylabel('獲獎年齡',fontsize=14)
plt.xlabel('獲獎領域',fontsize=14)
plt.xticks(rotation=45,fontsize=14)
plt.legend(loc=9,bbox_to_anchor=(0.86,0.96))
評論
圖片
表情











