实验二
Python
语言基础函数包练习
姓名:
季鹏
班级:
1208
学号:
2012301630030
实验目的
1
>
熟练掌握
Python
语言基础函数包
,
如
math
、
NumPy
、
SciPy
和
Matplotlib
等
函数包的使用
实验内容
练习
1
基本统计可视化:
Step 1.
导入编程所需要函数包:
#
第二次练习
,
基础
python
函数工具包
import numpy as
np import scipy as spy
import matplotlib.mlab as mlab import
matplotlib.pyplot as pit
Step 2.
柱状图町视化:
#simulate the data
mu’ sigma = 100^ 15
x = mu + sigma*np.random.randn(10000)
#
draw the histogram of thw data
bins” patches = pit.hist(x^
50,
nfacecolor='greealpha=0.75)
#
add a
1
best fit' line
y = mlab.normpdf( bins
丿
mu
丿
sigma)
1 = pit.plot(bins» y
丿
'
广丿
linewidth
二
1)
pit.xlabel('Smarts')
pit
pit
广
m{Histogram\ of\ IQ:}\ \mu=100
>
\ \sigma=15$
1
) plt
,
0e03])
pit•grid(True)
pit•show()
对视化结杲(将图粘贴到这个位置人