Skip to content
Advertisement

how to detect a braking process in python dataframe

I have some trips, and for each trip contains different steps, the data frame looks like following:

JavaScript

I want to know if, on a trip X, the cyclist has braked (speed has decreased by at least 30%). The problem is that the duration between every two steps is each time different. For example, in 6 seconds, the speed of a person X has decreased from 28 km/h to 15 km/h.. here we can say, he has braked, but if the duration was high, we will not be able to say that My question is if there is a way to apply something to know if there is a braking process, for all data frame in a way that makes sense

Advertisement

Answer

The measure of braking is the “change in speed” relative to “change in time”. From your data, I created a column ‘acceleration’, which is change in speed (Km/h) divided by duration (seconds). Then the final column to detect braking if the value is less than -1 (Km/h/s).

Note that you need to determine if a reduction of 1km/h per second is good enough to be considered as braking.

JavaScript

Output:

JavaScript
Advertisement