BUG: NaN should have pct rank of NaN
State: closed

Closes #22519.

Labels:
name: Groupby
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: Regression
description: Functionality that used to work in a prior pandas version

Comments:
Hello @gfyoung! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`pandas/tests/groupby/test_rank.py`](https://github.com/gfyoung/pandas/blob/67f17514b009c0cc1160f517a7cd6bfb6b816530/pandas/tests/groupby/test_rank.py) !


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22600?src=pr&el=h1) Report
> Merging [#22600](https://codecov.io/gh/pandas-dev/pandas/pull/22600?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/70c9003c9e67c34fb31d4b6be8d8b970dfacbd38?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/22600/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/22600?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #22600   +/-   ##
=======================================
  Coverage   92.05%   92.05%           
=======================================
  Files         169      169           
  Lines       50783    50783           
=======================================
  Hits        46749    46749           
  Misses       4034     4034
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.46% <ø> (ø)` | :arrow_up: |
| #single | `42.3% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22600?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22600?src=pr&el=footer). Last update [70c9003...b904ec2](https://codecov.io/gh/pandas-dev/pandas/pull/22600?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Circle failure is related to Hypothesis timeout, which is not related to my PR.

cc @jreback 
@jreback : Made the requested change and all is green.  PTAL.
thanks @gfyoung I *think* this will backport cleanly.
Owee, I'm MrMeeseeks, Look at me.
                    
There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.
                    
```
$ git checkout 0.23.x
$ git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
$ git cherry-pick -m1 e6843c4b9754ae149cc6ff5cd58db05138327b74
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
$ git commit -am 'Backport PR #22600: BUG: NaN should have pct rank of NaN'
```

4. Push to a named branch :

```
git push YOURFORK 0.23.x:auto-backport-of-pr-22600-on-0.23.x
```

5. Create a PR against branch 0.23.x, I would have named this PR:

> "Backport PR #22600 on branch 0.23.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
@jreback : The `cherry-pick` is not cooperating.  I'll go backport it myself.