如何匹配具有不同bin大小的两个离散值列表?

问题描述 投票:0回答:1

我在24小时内都有两个DataFrame,其中包括2列(Timestamp和Consumption)。第一个DataFrame中的数据每8秒记录一次,第二个DataFrame中的数据每6秒记录一次。数据集是同一天在房屋中大约有2种不同的设备。现在我想匹配这两个DataFrame,以便能够从另一个中减去一个。实际上,我想将8秒间隔的DataFrame转换为6秒间隔的DataFrame。

示例(任意消耗值):

DataFrame A: timestamp  consumption
             00:00:00   125
             00:00:08   123
             00:00:16   150
             00:00:24   142
             00:00:32   130

DataFrame B: timestamp  consumption
             00:00:00   235
             00:00:06   222
             00:00:12   341
             00:00:18   321
             00:00:24   302
             00:00:30   289

请注意,有时时间戳不准确,并且有时由于噪声,间隔有时可能是7秒,而不是8或6秒。

UPDATE:我在00:00:00和00:00:08(分别是125和123)使用了DataFrame A,我想在00:00:06估计该值]

我在24小时内都有两个DataFrame,其中包括2列(Timestamp和Consumption)。第一个DataFrame中的数据每8秒记录一次,第二个DataFrame中的数据为...

python pandas encoding timestamp binning
1个回答
0
投票

您可以在merge中使用joinPandas.Dataframe方法进行左,右或内部联接操作。

© www.soinside.com 2019 - 2024. All rights reserved.