Skip to content

Conversation

@dsm054
Copy link
Contributor

@dsm054 dsm054 commented Feb 13, 2014

This adds a method='dense' option to rank which does the same thing as the one in scipy.stats.rankdata: the first ranked group gets 1, the second 2, etc. Basically it ports the approach used in scipy.stats._rankdata_fused to the pandas rankdata implementation.

It also adds a few tests that the various methods do what they're supposed to, which I couldn't find a test for before.

closes #6333

@jreback jreback added this to the 0.14.0 milestone Feb 13, 2014
@dsm054
Copy link
Contributor Author

dsm054 commented Feb 13, 2014

(1) The tests I couldn't find were lurking in test_stats.py, so I should add to those instead of tossing them in test_series.py.

(2) I'm not sure what I'm doing which is breaking everything -- the code passes every test for me. Any obvious goofs I'm missing?

@jreback
Copy link
Contributor

jreback commented Feb 13, 2014

nothing obvious....

@dsm054
Copy link
Contributor Author

dsm054 commented Feb 14, 2014

Ah, got it. When I added total_tie_count, what was formerly dups=0 became dups, total_tie_count=0 and dups was no longer being initialized. That explains why even the cases which shouldn't have been affected at all started breaking, and why my tests passed even though Travis was barfing.

It must have worked for me by fluke. Will fix.

@dsm054 dsm054 closed this Feb 14, 2014
@dsm054 dsm054 deleted the add_dense_rank branch February 14, 2014 06:37
@dsm054
Copy link
Contributor Author

dsm054 commented Feb 14, 2014

Managed to get it working last night but got the branch into a weird inconsistent state. Will make a new one instead.

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

Labels

Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Enhancement Numeric Operations Arithmetic, Comparison, and Logical operations

2 participants