聚合具有重叠时间序列的多个数据帧

时间:2017-06-25 12:45:02

标签: python pandas

我在dfList中有多个带有时间序列索引的数据帧。(示例数据框如下所示)
我尝试通过以下命令将这些数据帧连接成一个数据帧。

db=pd.concat(dfList)

我得到了以下数据框 enter image description here
时间序列索引是重复的(许多索引是2012-10-12 20:00:00),因为基础数据帧中的时间序列相互重叠。
我想删除这个副本。有谁知道如何做到这一点?

时间序列索引重叠的一些示例数据框如下所示

enter image description here

enter image description here

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以简单地按照提到的in the docs here按特定列值删除重复项。你可以这样做:

db = db.drop_duplicates(cols="Timestamp")

将删除列中的重复项的所有行"时间戳"除了第一次出现。

希望这有帮助!

相关问题