数据分析的基本步骤:

  1. 了解你的数据(get to know your data),
  2. 做一些统计学处理(像僵尸一样盯着数字不会带给你任何灵感!)
  3. 实现可视化(get a better feeling for your data.)。

1、numpy 自带生成数据的函数

2、numpy 具有各种统计学函数

# np_baseball is available

# Import numpy
import numpy as np # Create np_height from np_baseball
np_height = np_baseball[:,0] # Print out the mean of np_height
print(np.mean(np_height)) # Print out the median of np_height
print(np.median(np_height))

/

# np_baseball is available

# Import numpy
import numpy as np # Print mean height (first column)
avg = np.mean(np_baseball[:,0])
print("Average: " + str(avg)) # Print median height. Replace 'None'
med = np.median(np_baseball[:,0])
print("Median: " + str(med)) # Print out the standard deviation on height. Replace 'None'
stddev = np.std(np_baseball[:,0])
print("Standard Deviation: " + str(stddev)) # Print out correlation between first and second column. Replace 'None'
corr = np.corrcoef(np_baseball[:,0], np_baseball[:,1])
print("Correlation: " + str(corr))

/

# heights and positions are available as lists

# Import numpy
import numpy as np # Convert positions and heights to numpy arrays: np_positions, np_heights
np_positions = np.array(positions)
np_heights = np.array(heights) # Heights of the goalkeepers: gk_heights
gk_heights = np_heights[np_positions == 'GK'] # Heights of the other players: other_heights
other_heights = np_heights[np_positions != 'GK'] # Print out the median height of goalkeepers. Replace 'None'
print("Median height of goalkeepers: " + str(np.median(gk_heights))) # Print out the median height of other players. Replace 'None'
print("Median height of other players: " + str(np.median(other_heights)))

3、numpy 貌似不可以做数据可视化······

可视化是从数据中获取灵感、直觉的一种途经!

Python笔记 #08# NumPy: Statistic Basis的更多相关文章

  1. Python笔记 #06# NumPy Basis & Subsetting NumPy Arrays

    原始的 Python list 虽然很好用,但是不具备能够“整体”进行数学运算的性质,并且速度也不够快(按照视频上的说法),而 Numpy.array 恰好可以弥补这些缺陷. 初步应用就是“整体数学运 ...

  2. Python笔记 #07# NumPy 文档地址 & Subsetting 2D Arrays

    文档地址:np.array() 1.<class 'numpy.ndarray'> ndarray 表示 n 维度(n D)数组 (= n 行数组). 2.打印 array 结构 —— n ...

  3. python及pandas,numpy等知识点技巧点学习笔记

    python和java,.net,php web平台交互最好使用web通信方式,不要使用Jypython,IronPython,这样的好处是能够保持程序模块化,解耦性好 python允许使用'''.. ...

  4. CS229 笔记08

    CS229 笔记08 Kernel 回顾之前的优化问题 原始问题为: \[ \min_{w,b} \frac{1}{2}||w||^2\\[1.5em] {\text{s.t.}}y^{(i)}\le ...

  5. 【Python笔记】Python语言基础

    Python是一种解释性(没有编译).交互式.面向对象的语言 1.安装python编译器 版本:Python2.7比较普遍,Python不是向下兼容的软件,因此Python3.x有些东西不好找资料 2 ...

  6. python笔记41-虚拟环境virtualenv

    前言 如果你是一个python初学者,我是不建议你搞python虚拟环境的,我看到很多python的初学者同学,使用最新版的pycharm,新建一个工程时候默认就是venu虚拟环境. 然后在使用cmd ...

  7. Python笔记之不可不练

    如果您已经有了一定的Python编程基础,那么本文就是为您的编程能力锦上添花,如果您刚刚开始对Python有一点点兴趣,不怕,Python的重点基础知识已经总结在博文<Python笔记之不可不知 ...

  8. boost.python笔记

    boost.python笔记 标签: boost.python,python, C++ 简介 Boost.python是什么? 它是boost库的一部分,随boost一起安装,用来实现C++和Pyth ...

  9. 20.Python笔记之SqlAlchemy使用

    Date:2016-03-27 Title:20.Python笔记之SqlAlchemy使用 Tags:python Category:Python 作者:刘耀 博客:www.liuyao.me 一. ...

随机推荐

  1. 通过([AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.Read)] )在前台html页面调用cs方法

    app_code中CS代码( Cs页面文件名public class ajaxGET): [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement ...

  2. .net Asp AdRotator(广告控件)

    1.新建项目名称AdRotator 2.右键项目名称添加一个xml文件命名为AdRotator.xml <?xml version="1.0" encoding=" ...

  3. windows 10激活

    1.安装Microsoft Toolkit 解压,安装 2.打开Microsoft Toolkit软件 点击下面红色框框 等到出现下面内容后,继续下一步 3.点击下面按钮 等待片刻后,出现下面结果,就 ...

  4. 如何用css给input的placeholder设置颜色

    我在做页面的时候遇到过这种情况,在input标签中有默认字,但是设计稿上的颜色和input标签中的placeholder的默认颜色不一致.虽然我们可以在js中写出,但是有点过于麻烦了. 所以我就用cs ...

  5. Windows 7 Ultimate(旗舰版)SP1 32/64位官方原版下载地址

    MSDN于2011年5月12日,最新发布简体中文Windows 7 Ultimate 旗舰版 SP1 DVD镜像安装包,分32位和64位两个版本.最新发行代号分别是:677486(32位),67740 ...

  6. HDU 1103 Flo's Restaurant(模拟+优先队列)

    Flo's Restaurant Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  7. Database Partitioning Options DATABASE SHARDING

    w主写从读.集群节点间时时内存复制.单表横切纵切.分析报表系统通过服务器联表 http://www.agildata.com/database-sharding/ Database Partition ...

  8. DNS named. bind linux (ACL/View)---dnsmasq-with docker,hosts in docker.

    [bind--named.conf] https://blog.csdn.net/z_yttt/article/details/53020814 [Docker搭建dnsmasq] https://b ...

  9. 洛谷P2325王室联邦 SCOI2005 构造+树上分块

    正解:构造 解题报告: 照例先放传送门 umm其实我jio得这题应该在教树上莫队的时候港,应该是用来帮助理解树上莫队的分块方式的 然而这题是在学了树上分块之后再遇到的?就显得没那么难了吼 然后就随便说 ...

  10. js基础面试高频面点1:变量提升

    一.什么是变量提升?var变量提升的底层原理是什么? 变量提升的定义:所有变量的声明语句都会被提升到代码头部,这就是变量提升. 原理:引擎在读取js代码的过程中,分为两步,专业来说代码运行是分为预处理 ...