-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
Closed
Labels
BugNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations
Milestone
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.0Problem 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.
Metadata
Metadata
Assignees
Labels
BugNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations