-
Overview
From pandas.DataFrame.rolling, 其参数window可选用int, offset, or BaseIndexer subclass.
In a nutshell, if you use an
offset
like “2D” (which mean 2 days), pandas will use the datetime info in the index (if avaiable), potentially accounting for any missing rows or irregular frequencies.But if you use a simple
int
like 2, then pandas will treat the index as a simple integer index [0,1,2,…] and ignore any datetime info in the index.offset 是针对datetime格式的index进行范围限定,如果dataFrame的序列未按照时间排序,它也会筛选出来,但是通过int,窗口就是顺序计数。
df=pd.DataFrame({ 'x':range(4)}, index=pd.to_datetime(['1-1-2018','1-2-2018'
pandas window中涉及的offset是什么意思
最新推荐文章于 2023-06-13 15:06:37 发布