累积记录的每日和每小时功耗使不匹配不匹配
我是每小时计算的功率计的每日数据,具有累积的记录能源消耗如下:
设备 | 时间 | kWh |
---|---|---|
仪表 | 2022年5月12日21:05:00 | 900 900 |
米1 | 12 2022 21:20:00 | 930 930 |
米1 | 12 2022 21 :55:00 | 950 |
米1 | 2022 22:05:00 | 1000 |
米 | 12022 22:55:00 | 1050 |
米1 | 13 5月13日2022 00:05:00 | 1200 |
我尝试按日期和日期进行分组。但是在此之后,数据看起来并不如下:
Hourly report:
Meter 1|12 May 2022 21:00:00 |50 (950-900)
Meter 1|12 May 2022 22:00:00 |50 (1050-100)
Meter 1|13 May 2022 00:00:00 |0 (only 1 data)
Daily report:
Meter 1|12 May 2022 |150 (1050-900)
Meter 1|13 May 2022 |0 (only 1 data)
- >在2022年5月12日,每小时和每天都不等于,
因此我想找到一种按照以下数据计算的方法:
Hourly report:
Meter 1|12 May 2022 21:00:00 |50 (950-900)
Meter 1|12 May 2022 22:00:00 |100 (1050-950)
Meter 1|13 May 2022 00:00:00 |150 (1200-1050)
Daily report:
Meter 1|12 May 2022 |150 (1050-900)
Meter 1|13 May 2022 |150 (1200-1050)
我希望找到从新的小时数据/最后一个小时数据中解决问题不匹配的方法,新的一天数据/最后一天数据。
目前,我正在使用Python和Pandas。
I am calculate hourly and daily data for a power meter with accumulated record energy consumption as below:
Device | Time | kWH |
---|---|---|
Meter 1 | 12 May 2022 21:05:00 | 900 |
Meter 1 | 12 May 2022 21:20:00 | 930 |
Meter 1 | 12 May 2022 21:55:00 | 950 |
Meter 1 | 12 May 2022 22:05:00 | 1000 |
Meter 1 | 12 May 2022 22:55:00 | 1050 |
Meter 1 | 13 May 2022 00:05:00 | 1200 |
I try to group by time of date, and date. But after that data look not make sense as below:
Hourly report:
Meter 1|12 May 2022 21:00:00 |50 (950-900)
Meter 1|12 May 2022 22:00:00 |50 (1050-100)
Meter 1|13 May 2022 00:00:00 |0 (only 1 data)
Daily report:
Meter 1|12 May 2022 |150 (1050-900)
Meter 1|13 May 2022 |0 (only 1 data)
-> Hourly and daily is not equal for day 12 May 2022
So I would like to find a method to calculate as expect data below:
Hourly report:
Meter 1|12 May 2022 21:00:00 |50 (950-900)
Meter 1|12 May 2022 22:00:00 |100 (1050-950)
Meter 1|13 May 2022 00:00:00 |150 (1200-1050)
Daily report:
Meter 1|12 May 2022 |150 (1050-900)
Meter 1|13 May 2022 |150 (1200-1050)
I hope to find out method to solve the issue mismatch from new hour data/last hour data, new day data/last day data.
Currently I am using python and pandas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
想法是
设备
和grouper
withgroupby.lastby.last
,在device
中获得差异,并首先替换通过订阅的最后一个ANF的值:Idea is aggregate per
Device
and hours/days inGrouper
withGroupBy.first
andGroupBy.last
, get difference perDevice
and replace first value by substract last anf first value: