简体   繁体   English

在熊猫中重新采样

[英]Resample in pandas

I want to resample at minute but the value of the sample at minute t must come from the last previous value.我想在分钟重新采样,但在分钟 t 的样本值必须来自上一个上一个值。

However, doing a resample.last(), it takes the last value of the current set.但是,执行 resample.last() 时,它会获取当前集合的最后一个值。

How to do ?怎么做 ?

您可以将DataFrame.resamplelast一起使用,对于以前的值添加DataFrame.shift

df = df.resample('1Min').last().shift()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM