Suppose I have two dataframe df1
and df2
In df1
date value
0 2018-01-23 10:00:00 10
1 2018-01-23 11:00:00 20
2 2018-01-23 12:00:00 30
In df2
date value
0 2018-01-23 10:02:00 10
1 2018-01-23 10:03:00 20
2 2018-01-23 10:04:00 30
3 2018-01-23 10:05:00 40
4 2018-01-23 10:06:00 50
5 2018-01-23 11:07:00 50
...
Update:
I want to calculate the summation of df2.value
based on the interval selected by df1.date.iloc[n-1]
and df1.date.iloc[n]
. I can get index of df2.date
by IntervalIndex
but unable to select the value inside each interval.