Pipeline output looked sorted except where it obviously wasn't. Took me a while to narrow down. >>> nan = float('nan') >>> sorted([3, nan, 1, 2]) [3, nan, 1, 2] All comparisons with NaN return False, so sorted's assumption that < is a consistent ordering is broken. It doesn't raise. It returns something, and what it returns depends on where the NaN happens to be. Same goes for min and max. Filter …