数据分析的基本步骤:

  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. 为什么setinterval和settimeout越点击越快以及响应的解决办法

    setinterval大家都很了解,但是如果时间长的话,误差也会越来越大,所以我习惯上使用settimeout的递归,闲来没事,写了一个定时器的递归 <!DOCTYPE html> < ...

  2. Android英文文档翻译系列(4)——PopupWindow

    public class PopupWindow extends Object //直接继承至Object java.lang.Object ↳ android.widget.PopupWindow  ...

  3. android基础---->Fragment的使用

    碎片(Fragment)是一种可以嵌入在活动当中的UI 片段,它能让程序更加合理和充分地利用大屏幕的空间,因而在平板上应用的非常广泛. Fragment的基础例子

  4. java父类可以强制转化成子类吗?

    转自:http://blog.csdn.net/ld422586546/article/details/9707997 Java中父类强制转换成子类的原则:父类型的引用指向的是哪个子类的实例,就能转换 ...

  5. 【node】----mocha单元测试框架-----【巷子】

    1.mocha简介 单元测试是用来对一个模块.一个函数.或者一个类来进行正确性的检测工作   特点:      既可以测试简单的JavaScript函数,又可以测试异步代码,           可以 ...

  6. Css-常用css初始化

    /*PC初始化*/ * {;;; } body, html { width: 100%; height: 100%; min-width: 1024px; } body { font-size: 14 ...

  7. SpringCloud--Ribbon负载均衡

    Ribbon实现客户端负载均衡 负载均衡:是对系统的高可用.网络压力的缓解和处理能力扩容的重要手段之一. 硬件负载均衡:主要通过在服务器节点之间安装专门用于负载均衡的设备: 软件负载均衡:通过在服务器 ...

  8. java 中的控制台端口的输入

    java 中基于控制台端的输入时最基本的操作. 第一步 导入Scanner类 import java.util.Scanner; 第二步 创建输入对象 input Scanner input=new ...

  9. 棋盘游戏---hdu1281(最大匹配)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1281   题目大意:就是车和车之间不能发生攻击.还有一部分位置不可以放置棋子.   解题思路:一行一列 ...

  10. 《图解HTTP》书摘

    图解HTTP 上野宣.于均良 1.3 网络基础 TCP/IP 2016-03-03 相互通信,双方就必须基于相同的方法.比如,如何探测到通信目标.由哪一边先发起通信.使用哪种语言进行通信.怎样结束通信 ...