王波170318作業(yè)-IQ數(shù)據(jù)分析

IQ數(shù)據(jù)分析

自己之前做第一次作業(yè),拿別人的作業(yè)來研究了一番,算不上獨立完成。這次,我還是自己一步步研究吧
# 導入數(shù)據(jù)包
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

%matplotlib inline
%config InlineBackend.figure_format = 'retina'
# ??以上兩段代碼,什么意思,需要研究。

#導入Iq數(shù)據(jù)
iq_data = pd.read_csv('IQscore.csv')

# 查看前五行
iq_data.head(5)
len(iq_data)
70
# 將iq_data 中’IQ‘這一列數(shù)據(jù)存入變量iq中
iq = iq_data['IQ']

#計算平均值和標準差
iq_mean=iq.mean()
iq_std = iq.std()

#輸出均值和方差
print("均值:"+str(iq_mean))
print('標準差:'+str(iq_std))
均值:100.82857142857142
標準差:15.015905990389498

數(shù)據(jù)可視化

x = np.arange(60,150,1)
#??這個60和150代表的是x軸的最大和最小值嗎? 那1代表什么意思呢?
def normfun(x,iq_mean,iq_std):
    pdf = np.exp(-((x-iq_mean)**2)/(2*iq_std**2))/(iq_std*np.sqrt(2*np.pi))
    return pdf
y = normfun(x,iq_mean,iq_std)
plt.plot(x,y)
plt.hist(iq,bins=7,rwidth=0.9,normed=True)
#?? bins=7意思是每個直方圖占7個數(shù)字那么寬嗎?,rwidth=0.9 是指,每兩個直方圖之間的間距為0.9嗎? normed=true是什么意思?
plt.title('IQ distribution')
plt.xlabel('IQ score')
plt.ylabel('Probability')

plt.show
<function matplotlib.pyplot.show>
成圖


ps:最開心的是,搗鼓出了,如何把notebook中的內(nèi)容,轉(zhuǎn)到簡書中。  

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容