python时间序列分析常用函数

1. pandas.DataFrame.rank

DataFrame.rank(axis=0method='average'numeric_only=Nonena_option='keep'ascending=Truepct=False)

功能:计算沿着轴的数值数据(1到n)。 等值的排名是这些值的排名的平均值。返回从小到大排序的下标。

参数:axis : {0 or ‘index’, 1 or ‘columns’}, 默认值0     按照哪个轴进行排序

      method : {‘average’, ‘min’, ‘max’, ‘first’}   默认值 average

      average :在相等分组中,为各个值分配平均排名

      min :使用整个分组的最小排名

      max :使用整个分组的最大排名

      first : 按值在原始数据中的出现顺序分配排名

    numeric_only : boolean, 默认值 None    仅包含float,int和boolean数据。 仅对DataFrame或Panel对象有效

    na_option : {‘keep’, ‘top’, ‘bottom’}  

      keep:将NA值保留在原来的位置

      top : 如果升序,将NA值排名第一

      bottom :如果降序,将NA值排名第一

      ascending : boolean, 默认值 True

      True 为升序排名  False为降序排名

       pct : boolean, 默认值 False

       计算数据的百分比等级

返回 :ranks : 与调用者类型相同

2. DataFrame.corr(method='pearson'min_periods=1)

Compute pairwise correlation of columns, excluding NA/null values,列的相关系数

Parameters:

method : {‘pearson’, ‘kendall’, ‘spearman’}

  • pearson : standard correlation coefficient
  • kendall : Kendall Tau correlation coefficient
  • spearman : Spearman rank correlation

min_periods : int, optional

Minimum number of observations required per pair of columns to have a valid result. Currently only available for pearson and spearman correlation

Returns:
y  :  DataFrame
3. DataFrame.corrwith(otheraxis=0drop=False计算DataFrame的列(axis=0,默认)或行(axis=1)跟另外一个Series或DataFrame之间的相关系数:

Compute pairwise correlation between rows or columns of two DataFrame objects.

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值