简体   繁体   English

Pandas resample.ffill()

[英]Pandas resample .ffill()

I have data in minutes I want to collect them per day and per hour without adding the sum because it is an increment if the total increases we add a 1 I tried the function ffill() pandas resample but it returns me this: [enter image description here我有几分钟内的数据我想每天和每小时收集它们而不添加总和,因为如果我们添加 1 的总增加量是一个增量我尝试了 function ffill() pandas 重新采样,但它返回给我:[输入图片描述在这里

You will need to say what kind of aggregation you are doing over your new resampled period.您需要说明在新的重新采样期间您正在执行哪种聚合。

If you just want to get the sum for each day: df2.resample('D').sum()如果您只想获取每天的总和: df2.resample('D').sum()

Then if you want to fill the NaN you can apply your transformation of choice ie ffill然后,如果您想填充 NaN,您可以应用您选择的转换,即 ffill

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

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