Saturday, 7 September 2013

Indexing pandas dataframe to return first data point from each day

Indexing pandas dataframe to return first data point from each day

Perhaps a novice question. In pandas, I have a Dataframe with datetime's
in a column (not the index), which span several days, and are at irregular
time intervals (i.e. not periodic). I want to return the first value from
each day. So if my datetime column looked like:
2013-01-01 01:00
2013-01-01 05:00
2013-01-01 14:00
2013-01-02 01:00
2013-01-02 05:00
2013-01-04 14:00
The command I'm looking for would return the dataframe columns for the
following indexes:
2013-01-01 01:00
2013-01-02 01:00
2013-01-04 14:00

No comments:

Post a Comment