Closed
Description
Code Sample, a copy-pastable example if possible
In []: df = pd.DataFrame([1, np.nan, np.inf, -np.inf, 25])
In []: df.rank()
Out []:
0
0 2.0
1 NaN
2 NaN
3 1.0
4 3.0
In []: df.rank(ascending=False)
Out []:
0
0 3.0
1 NaN
2 1.0
3 NaN
4 2.0
Problem description
np.inf
or -np.inf
gets grouped with np.nan
in the rank operation, depending on which direction the ranking occurs in. Ideally, np.inf
would be entirely separate from np.nan
.