统计相关

统计相关

一、次序统计

1、计算最小值

  • numpy.amin(a[, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,where=np._NoValue])Return the minimum of an array or minimum along an axis.

【例】计算最小值
在这里插入图片描述
2、计算最大值

  • numpy.amax(a[,axis=None,out=None,keepdims=np._NoValue, initial=np._NoValue,where=np._NoValue])Return the maximum of an array or maximum along an axis.

【例】计算最大值
在这里插入图片描述
3、计算极差

  • numpy.ptp(a, axis=None, out=None, keepdims=np._NoValue) Range of values (maximum -minimum) along an axis. The name of the function comes from the acronym for ‘peak to peak’.

【例】计算极差
在这里插入图片描述
4、计算分位数

  • numpy.percentile(a,q,axis=None,out=None,overwrite_input=False,interpolation='linear', keepdims=False) Compute the q-th percentile of the data along the specified axis. Returns the q-th percentile(s) of the array elements.

【例】计算分位数
在这里插入图片描述
二、均值与方差

1、计算中位数

  • numpy.median(a, axis=None, out=None, overwrite_input=False, keepdims=False) Compute the median along the specified axis. Returns the median of the array elements.

【例】计算中位数
在这里插入图片描述
2、计算平均值

  • numpy.mean(a[, axis=None, dtype=None, out=None, keepdims=np._NoValue)]) Compute the arithmetic mean along the specified axis.

【例】计算平均值
在这里插入图片描述
3、计算加权平均值

  • numpy.average(a[, axis=None, weights=None, returned=False]) Compute the weighted average along the specified axis.

meanaverage 都是计算均值的函数,在不指定权重的时候 averagemean 是一样的。指定权重
后, average 可以计算加权平均值。

【例】计算加权平均值
在这里插入图片描述在这里插入图片描述
4、计算方差

  • numpy.var(a[, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue]) Compute the variance along the specified axis.

【例】计算方差
在这里插入图片描述
5、计算标准差

  • numpy.std(a[, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue]) Compute the standard deviation along the specified axis.

标准差是一组数据平均值分散程度的一种度量,是方差的算术平方根。

【例】计算标准差
在这里插入图片描述
三、相关

1、计算协方差矩阵

  • numpy.cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None,aweights=None)Estimate a covariance matrix, given data and weights.

【例】计算协方差矩阵

在这里插入图片描述在这里插入图片描述
2、计算相关系数

  • numpy.corrcoef(x, y=None, rowvar=True, bias=np._NoValue, ddof=np._NoValue) Return Pearson product-moment correlation coefficients.

【例】计算相关系数
在这里插入图片描述
四、直方图

  • numpy.digitize(x, bins, right=False) Return the indices of the bins to which each value in input array belongs.

【例】
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值