Pandas Dataframe: Find Location Where Value Changes From X To Y
I am trying to find the points in a dataframe where the data hits a max value, holds it for a time, then drops down again (See image below). I am attempting to find the index's
Solution 1:
You will want to use the bitwise operator (&
) to combine your masks ((data['ESC_Command'] == 1600) & (data['ESC_Command'].shift() < 1600)
).
and
is the logical operator and is unable to compare series, hence the ValueError
.
Also, you can use data['ESC_Command'].max()
to dynamically find the maximum value in the column.
Post a Comment for "Pandas Dataframe: Find Location Where Value Changes From X To Y"