python中idx是什么意思_在python中滚动idxmax()?
参见⽂档:
还有⼀些很好的例⼦:In[18]:df=DataFrame(randn(1000,4),index=_range('20000101',periods=1000),
columns=list('ABCD'))
In[19]:g_apply(df,30,lambdax:Series(x).idxmax())
Out[19]:
DatetimeIndex:1000entries,2000-01-0100:00:00to2002-09-2600:00:00
Freq:D
Datacolumns(total4columns):
A971non-nullvalues
B971non-nullvalues
C971non-nullvalues
D971non-nullvalues
dtypes:float64(4)
In[47]:g_apply(df,30,lambdax:Series(x).idxmax()).tail(30)
Out[47]:
ABCD
2002-08-282432621
2002-08-292322520
2002-08-302212419
2002-08-312102318
2002-09-012062917
2002-09-021952816
2002-09-031842715
2002-09-041732614
2002-09-051622513
2002-09-061512412
2002-09-071402311
2002-09-
2002-09-091212219
2002-09-101111208
2002-09-111010197
2002-09-1299186
2002-09-1388175
2002-09-1477164
2002-09-1566153
2002-09-1655142
2002-09-1744131
2002-09-1833120
2002-09-19221111
2002-09-20111010
2002-09-210099
2002-09-22272588
2002-09-23262477
2002-09-24252366
2002-09-25242255
2002-09-26232944
仅供参考,使⽤rolling_max(df,30)来获取特定范围内的最⼤值可能会更好,这正是我收集到的您所追求的
本文发布于:2022-12-31 22:43:49,感谢您对本站的认可!
本文链接:http://www.wtabcd.cn/fanwen/fan/90/68286.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |