BUG: Fix IntervalTree handling of NaN
- [X] closes #23352
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry

xref #23327 : As far as I can tell the only reason that PR is failing is because of tests raising a `RuntimeWarning` due to this bug.
