实验二Python语言基础函数包练习.docxVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
实验二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 1best fit line y = mlab.normpdf( bins丿 mu丿 sigma) 1 = pit.plot(bins? y丿广丿 linewidth二1) pit.xlabel(Smarts) pit ylabel(Probability) pittitle(r*$\math广m{Histogram\ of\ IQ:}\ \mu=100\ \sigma=15$1) pltaxis([40, 160, 0, 0e03]) pit?grid(True) pit?show() 对视化结杲(将图粘贴到这个位置人 0.030 ,一Histogram of IQ: 0.0250.020A 七-一qeqojd0.0150.0100.005°00%100 Smarts 0.025 0.020 A 七-一qeqojd 0.015 0.010 0.005 °00% 100 Smarts 160 Step 3.散点图可视化: #seatter plot N = 50 x = np.random.rand(N) y 二 np.random rand(N) colors = np.random.rand(N) area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radiuses pit?seatter(x? s=areac=colors丿 alpha=05) pit.show() 可视化结果(将图粘贴到这个位置): Step 4: box?plot nJ视化 #boxplot np. wndom. seed(937) data = np? random.log门0广0131($匚26=(37? 4)丿 mean=l? 5》 sigma=1.75) labels = list(?ABCD1) fs = 10 # fontsize fig, axes = pit. subplots(”ows二2,ncols二3, figsize=(6^6)) axes[0^ 0].boxplot(data) labels=labels) axes[0^ 0].set_title(Default1, fontsize二fs) axes[0^ 1].boxplot(data, labels=labels^ showmeans=True) axes[0^ 1].set_titlw(showmeans二True,丿 fontsize=fs) axes[0^ 2].boxplot(data) labels=labels^ showmeans^True, meanline二True) axes[0^ 2]?e(showmeans二True,\nmeanline=True丿 fontsize=fs) fontsize=fs)axes[1^ 0].boxplot(dat6 labels=labels^ showbox=False^ showcaps二False) fontsize=fs) axes[1^ 0]?le(Tufte Style \n(showbox=False?\nshowcaps=False), axes[1^ 1].boxplot(data丿 labels=labels notch=True^ bootstrap=10000) axes[1^ 1].le(notch=True^\nbootstrap=100001, fontsize=fs) axes[1^ 2].boxplot(data^ labels=labels showfliers=False) axes[1^ 2]?le(s

文档评论(0)

ggkkppp + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档