ENH: Rolling rank
State: closed

xref https://github.com/pandas-dev/pandas/issues/9481
- [x] closes #9481
- [x] tests added / passed
- [ ] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [ ] whatsnew entry


Labels:
name: Enhancement
name: Window
description: rolling, ewma, expanding

Comments:
Hello @gsiano! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:













There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2021-09-13 18:29:13 UTC
cc @mroeschke 
will this close https://github.com/pandas-dev/pandas/issues/9481 ? (can pull some examples fromt here)
as a followup (can create an issue), need tests / impl for groupby.rolling.rank (it should just work though) 
What happens currently when there are ties?

`DataFrame.rank` currently has a `method` argument to control that behavior https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank
> What happens currently when there are ties?
> 
> `DataFrame.rank` currently has a `method` argument to control that behavior https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank

I added the `min`, `max`, and `average` rank methods. I still have to add the `dense` and `first` methods, and I'll look into adding the other flags from `DataFrame.rank`
> I added the `min`, `max`, and `average` rank methods. I still have to add the `dense` and `first` methods, and I'll look into adding the other flags from `DataFrame.rank`

the `first` method doesn't seem relevant for rolling rank, and `dense` probably deserves a separate pr
> > I added the `min`, `max`, and `average` rank methods. I still have to add the `dense` and `first` methods, and I'll look into adding the other flags from `DataFrame.rank`
> 
> the `first` method doesn't seem relevant for rolling rank, and `dense` probably deserves a separate pr

+1 on pushing `dense` to a separate pr. `ascending` would be a nice flag to have ... I wonder if something like just adding the negative of the value to the `skiplist` would handle flipping the order
> +1 on pushing `dense` to a separate pr. `ascending` would be a nice flag to have ... I wonder if something like just adding the negative of the value to the `skiplist` would handle flipping the order

That sounds like it will work. I'll try adding it.
> looks good, can you add
> 
> * whatsnew note (1.4 enhacements), wouldn't object to a small example if you'd like (or a single note ok)
> * add in the reference section: https://github.com/pandas-dev/pandas/blob/master/doc/source/reference/window.rst somewhere
> * this is _just_ for rolling, or works for expanding? (i think it should, can you add tests)
> * i think we need a doc-string in rolling.py

I added a test for expanding and updated the docs and whatsnew file. Is there a way to render the docs locally so I can see how it looks?
> Is there a way to render the docs locally so I can see how it looks?

https://pandas.pydata.org/pandas-docs/stable/development/contributing_documentation.html#how-to-build-the-pandas-documentation
oh see you approved, ok then.
thanks @gsiano very nice! pls create an issue for for the requested followups (PR as well if you can .....) keep em coming!