'Pandas resample by integration over time with non equidistant data
I have a DataFrame with a Datetimeindex with non equidistant timestamps. I want to get the mean for each hour. But by using resample.mean(), the time distance between the timestamps is not considered.
How can I resample a DataFrame with a Datetimeindex to integrate the values in a column?
given the following data:
| time | data |
|---|---|
| 00:15 | 5 |
| 00:55 | 1 |
| 00:56 | 1 |
| 00:57 | 1 |
resample.mean() would give 4, but the value 1 was only set for 3 from 60 minutes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
