-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
GroupbyMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations
Milestone
Description
xref #20091 @peterpanmj
In [51]: df = pd.DataFrame([1, np.nan, np.inf, -np.inf, 25])
In [52]: df['key'] = 'foo'
In [53]: df.groupby("key").rank() # not working properly for infinity
Out[53]:
0
0 2.0
1 NaN
2 NaN
3 1.0
4 3.0
In [54]: df.rank() # this is ok
Out[54]:
0 key
0 2.0 3.0
1 NaN 3.0
2 4.0 3.0
3 1.0 3.0
4 3.0 3.0
In [55]: df.groupby("key").apply(lambda x:x.rank()) # this is also ok
Out[55]:
0 key
0 2.0 3.0
1 NaN 3.0
2 4.0 3.0
3 1.0 3.0
4 3.0 3.0
Metadata
Metadata
Assignees
Labels
GroupbyMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations