Is there a way to check if one value of a vector is greater/smaller than the next one? Without using loops?
This is the vector: 1 2 4 3 6 9
And this would be the answer i need: true true false true true
Is there a way to check if one value of a vector is greater/smaller than the next one? Without using loops?
This is the vector: 1 2 4 3 6 9
And this would be the answer i need: true true false true true
Try looking at the diff
function in numpy
. That will give you the difference between each value and its right neighbor. You can then check if that value is smaller or larger than 0.