申明:本系列文章是本身在学习《利用Python进行数据分析》这本书的过程当中,为了方便后期本身巩固知识而整理。学习
In [1]: import numpy as np In [2]: import pandas as pd In [3]: from pandas import DataFrame,Series In [4]: data = {'class':['语文','数学','英语'],'score':[120,130,140]} In [5]: frame = DataFrame(data) In [6]: frame Out[6]: class score 0 语文 120 1 数学 130 2 英语 140
咱们来汇总一下成绩:spa
In [18]: frame.score Out[18]: 0 120 1 130 2 140 Name: score, dtype: int64
而后,咱们再进行汇总统计:code
In [20]: frame.sum() Out[20]: class 语文数学英语 score 390 dtype: object
固然,还有别的统计法则:orm
idxmin 最小值的索引值blog
idxmax 最大值的索引值索引
describe 一次性 多种维度统计数据分析
count 非NA值的数量数学
min 最小值pandas
max 最大值class
argmin 最小值的索引位置
argmax 最大值的索引位置
sum 总和
mean 平均数
median 算术中位数
mad 根据平均值计算平均绝对离差
var 样本值的方差
std 样本值的标准差
skew 样本值的偏度(三阶矩阵)
kurt 样本值的峰度(四阶矩阵)
cumsum 样本值的累积和
cummin、cummax 样本值的最大值、最小值
cumprod 样本值的累计积
diff 计算一阶差分
pct_change 计算百分数变化