Comparison on the right type
Filtering on a column that is still a string compares text: '9' > '10' is true. Convert once when you load, filter on the real type, and the bug disappears. Convert at the edges, not in the middle of every condition.
Missing values need a decision
Decide what a filter should do with a blank: keep it, drop it, or flag it. Python's None and JavaScript's null compare differently, and NaN is not equal to itself. An explicit rule beats an inherited one.