Filter out rows based on the row directly before and after that

I’m curious as well. But in the documentation I cannot see any instruction/keyword that “navigates” or “extracts” values from a sequence; difference is the only one, but it is of course applicable only to read the previous element, not the next.

EDIT: There’s an (unanswered) exception here, but it seems to apply to time series, which your example is not (or you didn’t mention the _time column at least).