The `rank()` function converts `np.nan` to `np.inf` or `-np.inf`, and therefore can't properly rank existing `np.inf`. See here: https://github.com/pydata/pandas/pull/6886#issuecomment-40773964. Test for this issue here: https://github.com/pydata/pandas/blob/master/pandas/tests/test_series.py#L4071