It should be very simple, but it got stuck for a long time, so make a note
For example
data
2016-02-04 01:00:00+00:00 1
2016-02-04 01:00:00+00:00 1
2016-02-04 01:30:00+00:00 2
2016-02-04 01:30:00+00:00 2
2016-02-04 02:00:00+00:00 3
If there is a DataFrame df like
grouped = df.groupby(level=0)
df2 = grouped.last()
so
data
2016-02-04 01:00:00+00:00 1
2016-02-04 01:30:00+00:00 2
2016-02-04 02:00:00+00:00 3
Is obtained.
Recommended Posts