如何将5分钟的间隔数据更改为每小时间隔
因此,我每5分钟都有每5分钟记录在恒温器上的温度数据。我想更改数据,以便文件仅具有每小时记录的数据。我知道有一种方法可以分组数据,但我不想要总和/最大/AVG等。我希望每小时温度。让我知道这是否有意义,以及您是否需要其他任何东西。 数据看起来像这样
So I have data of the temperature recorded on a thermostat every 5 minutes. I would like to change the data so that the file has only the data recorded every hour. I know there is a way to group the data but I don't want the sum/min/max/avg etc. I want the temperature for each hour. Let me know if this makes sense and if you need anything else.
The data looks like this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是我使用一些随机生成的数据提出的解决方案。我只是将数据框过滤到series.dt.minute属性等于0的位置。
Here is a solution I came up with using some randomly generated data. I just filtered the data frame to where the Series.dt.minute attribute equals 0.
Python的最简单方法是使用Pandas软件包。如果您没有它:
然后在脚本中导入它,并使用它来过滤第一列中不在小时的所有日期值。让我知道这是否对您有用。
Simplest way with python would be with the pandas package. If you don't have it:
Then in your script import it and use it to filter out all date values in the first column that are not on the hour. Let me know if this works for you.