数据分析的基本步骤:

  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. android基础---->AIDL服务的使用

    AIDL和其他的IDL类似,它允许你定义程序接口,以便客户端与服务器端通过IPC机制交互.在android上面,一个进程一般不能访问另外进程的内存.因此,Android平台将这些跨进程访问的对象分解成 ...

  2. java - OutOfMemoryError: Java heap space 堆空间不足

    Error occurred during initialization of VM Could not reserve enough space for object heap Error: Cou ...

  3. 拦截chrome的console.log输出

    console.log = function(){}; 这样 console.log(123) 将不会在输出任何调试信息

  4. Eclipse打包Egret App (Egret4.1.0)

    Egret官方提供eclipse和androidstudio打包. 这里使用eclipse. 1 下载配置android环境 2 Egret打包App 3 Eclipse设置 4 Eclipse调试 ...

  5. 微信小程序 --- 获取网络状态

    获取网络状态:wx.getNetworkType btnclick:function(){ wx.getNetworkType({ success:function(res){ console.log ...

  6. JS复制制定内容到剪贴板怎么做?

    可以使用input也可以使用textare文本域来做(而且这个input/textarea不能够被隐藏): <a href="javascript:;" onclick=&q ...

  7. rman备份的其它特性

    1.7.3.1并发: 主要用于提高备份的速度,可以分为手动并发或自动并发 手动并发:通过分配多个通道并将文件指定到特定的通道 RMAN> run { 2>  allocate channe ...

  8. mycelipse中关于编码的配置

    (1)修改工作空间的编码方式: Window->Preferences->General->Workspace->Text file Encoding在Others里选择需要的 ...

  9. Linux下手工卸载11.2 RAC(非MOS的deinstall方法)

    思路来自于经典的<How to Proceed From a Failed 10g or 11.1 Oracle Clusterware (CRS) Installation (Doc ID 2 ...

  10. Mongo Rocks 在SSD盘上表现优秀,专门为SSD盘的优化

    2017 · MongoDB深圳用户组大会全记录 | MongoDB中文社区http://www.mongoing.com/2017/04/24/mongodb-shenzhen-user-group ...