深入学习Pandas : Window

  • Window

    Rolling objects are returned by .rolling calls : pandas.DataFrame.rolling();

    Expanding objects are returned by .expanding calls : pandas.DataFrame.expanding();

    ExponentialMovingWindow objects are returned by .ewm calls : pandas.DataFrame.ewm();

    Window是一个类,pandas.core.window.rolling.Rolling.count是函数。

  • pandas.DataFrame.rolling

    DataFrame.rolling(window, min_periods=None, center=False, win_type=None, on=None, axis=0, closed=None)

    Provide rolling window calculations.

  • Parameters
    1. window : int, offset, or BaseIndexer subclass

      BaseIndexer

      class pandas.api.indexers.BaseIndexer(index_array=None, window_size=0,**kwargs)

      Base class for window bounds calculations.

      Size of the moving window. This is the number of observations used for calculating the statistic.

      Each window will be a fixed size.

      If its an offset then this will be the time period of each window. Each window will be a variable sized based on the observations included in the time-period. This is only valid for datetimelike indexes.

      If a BaseIndexer subclass is passed, calculates the window boundaries based on the defined get_window_bounds method. Additional rolling keyword arguments, namely min_periods ,center, and closed will be passed to get_window_bounds.

    2. min_periods: int, default None

      Minumum number of observations in window required to have a value (otherwise result is NA).

      For a window that is specified by an offset, min_periods will default to 1. Otherwise, min_periods will default to the size of the window.

      关于offset参见《pandas window中涉及的offset是什么意思》

    3. center : bool, default False

      Set the labels at the center of the window

    4. win_type : str, default None

      Provide a window type.

      If None, all points are evenly weighted.

    5. on : str, optional

      For a DataFrame, a datetime-like column or MultiIndex Level on which to calculate the rolling window, rather than the DataFrame’s index.

      Provided integer column is ignored and excluded from result since an integer index is not used to calculate the rolling window.

    6. axis : int or str, default 0

    7. closed : str, default None

      Make the interval closed on the ‘right’, ‘left’, ‘both’ or ‘neither’ endpoints.

      For offset-based windows, it default to ‘right’.

      For fixed windows, default to ‘both’.

      Remaining cases not implemented for fixed windows.

      Returns : A Window or Rolling sub-classed for the particular operation.

    By default, the result is set to the right edge of the window. This can be changed to the center of the window by setting center=True.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值