I have a pandas dataframe df
that goes like this
index data
midnight 1
1am 1
2am 1
2am 1
I want to count the number of lines in the last 90 minutes excl, to do so, I do
df.rolling("90min", closed="left").fillna(0)
Result is
index data
midnight 0
1am 1
2am 1
2am 2
Considering 2am
is a duplicate index, I would like the last value to be 1
instead of 2
. Any idea ?