>> ser.ra...">

BUG: rank with object dtype and small values (original) (raw)

Based on test_rank_ea_small_values

import pandas as pd

ser = pd.Series( [5.4954145e29, -9.791984e-21, 9.3715776e-26, pd.NA, 1.8790257e-28], dtype="Float64", ) ser2 = ser.astype(object)

ser.rank(method="min") 0 4.0 1 1.0 2 3.0 3 NaN 4 2.0 dtype: float64

ser2.rank(method="min") 0 4.0 1 1.0 2 1.0 3 NaN 4 1.0 dtype: float64

I'd expect 1) the values to match and 2) to get NA rather than NaN at least for the Float64 case.

Update: if we convert to float64[pyarrow] first we do get NA back and a uint64[pyarrow] dtype.