New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Series/DataFrame.rank() doesn't handle np.inf properly #6945

nspies opened this Issue Apr 23, 2014 · 3 comments


None yet
3 participants

nspies commented Apr 23, 2014

The rank() function converts np.nan to np.inf or -np.inf, and therefore can't properly rank existing np.inf. See here: #6886 (comment).

Test for this issue here:


This comment has been minimized.


jreback commented Apr 23, 2014

@nspies this has your name on it too!

@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015


This comment has been minimized.


peterpanmj commented Sep 22, 2017

I'm using pandas '0.20.1'. Ranking series with np.inf still yields np.nan. Will this be fixed ?

s= pd.Series(data = np.array([1,2,3,math.inf,4,4,4,5,5]))
0    1.0
1    2.0
2    3.0
3    NaN
4    5.0
5    5.0
6    5.0
7    7.5
8    7.5
dtype: float64

This comment has been minimized.


jreback commented Sep 22, 2017

@peterpanmj pull request for this are welcome, its pretty straightforward to fix.

@peterpanmj peterpanmj referenced this issue Oct 17, 2017


BUG: rank with +-inf, #6945 #17903

4 of 4 tasks complete

@jreback jreback modified the milestones: Next Major Release, 0.22.0 Oct 28, 2017

peterpanmj added a commit to peterpanmj/pandas that referenced this issue Dec 3, 2017

jreback added a commit that referenced this issue Dec 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment