2024-10-16 22:25:22 发布
网友
我在excel中有一些过去20年左右的股市数据,其中包含假期和周末的缺口。我希望对这些缺失的日期进行插值,以获得这些天的大致股票指数。
我已经使用pandas将这两列读入Python,并将它们分配给各自的变量。检测日期中的间隔并对其进行插值的最佳方法是什么
熊猫有专门针对这种情况的方法:
df.interpolate() # will fill in based on the linear average of the before and after df.fillna(method='ffill') # forward fill df.fillna(method='bfill') # backward fill
熊猫有专门针对这种情况的方法:
相关问题 更多 >
编程相关推荐