I am looking at the velocity of a vehicle and the only data I have is that the velocity is stable, slowing down or stopped (see df below). There is another one (speeding up) but this one is not found in the current df.
As you can see there are 2 "slowing down" periods. I am only interested in the data starting from the last "slowing down" period before stopped.
How do I filter the data in such a way that I can drop the first x rows that I am not interested in? Since the velocity values are always different, I cannot simply filter on values.
Hope you can help!
import pandas as pd
data = {
"Date and Time": ["2020-06-07 00:00", "2020-06-07 00:01", "2020-06-07 00:02", "2020-06-07 00:03", "2020-06-07 00:04", "2020-06-07 00:05", "2020-06-07 00:06", "2020-06-07 00:07", "2020-06-07 00:08", "2020-06-07 00:09", "2020-06-07 00:10", "2020-06-07 00:11", "2020-06-07 00:12", "2020-06-07 00:13", "2020-06-07 00:14", "2020-06-07 00:15", "2020-06-07 00:16", "2020-06-07 00:17", "2020-06-07 00:18", "2020-06-07 00:19", "2020-06-07 00:20"],
"Values": ["Stable","Stable","Stable","Stable", "Slowing down","Slowing down","Slowing down","Stable", "Stable", "Stable", "Slowing down","Slowing down","Slowing down","Slowing down","Slowing down","Slowing down","Slowing down","Slowing down", "Stopped", "Stopped", "Stopped"]
}
df = pd.DataFrame(data)
df.head()