Filter Pandas DataFrame by time index

Python Programming

Question or problem about Python programming:

I have a pandas DataFrame from 6:36 AM to 5:31 PM. I want to remove all observations where the time is less than 8:00:00 AM. Here is my attempt:

df = df[df.index < '2013-10-16 08:00:00']

This does nothing, please help.

How to solve the problem:

You want df.loc[df.index < '2013-10-16 08:00:00'] since you're selecting by label (index) and not by value.

selecting by label

Hope this helps!