Roll quantile support multiple quantiles as per #12093: rough sketch for discussion
State: closed

- [ ] closes #12093

Putting this in a PR for discussion. It definitely needs more work on kicking the arguments through properly in the python interface but someone who has strong opinions about that can hopefully step in and then will refactor and test etc.

The "content" is really just the cython change. 


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

Comments:
Hello @cottrell! 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 2020-07-01 14:41:44 UTC
@cottrell sorry this hasn't seen any attention; we have a number of PRs.

conceptually this would be ok. I would want to refactor out the actual quantile code to make the multiple loops in cython reasonable.

Does this change the perf of the single quantile case?

the return value here is also slightly tricky as now we'd have to return a frame (rather than a series), but that's prob ok (I think we do that anyhow for regular quantile).

please merge master. 
cc @mroeschke 
@jreback 

Old timings are in the issue https://github.com/pandas-dev/pandas/issues/12093 

I just tried on some latest pandas and see same order for usual single quantile.

I've sort of forgotten the details here but I think the most time consuming and complicated bit was really the python and passing arguments through the rolling patterns. Any cython changes are likely easy or at least transparent. I think the API itself likely requires some pandas internals knowledge and opinions.

```
In [1]: s = pd.Series(np.random.randn(100000))                                                                                                                                                                     

In [2]: n = 10                                                                                                                                                                                                     

In [3]: q = np.linspace(1./n, 1 - 1./n, n - 1)                                                                                                                                                                     

In [4]: r = s.rolling(window=100)                                                                                                                                                                                  

In [5]: %time a = pd.DataFrame({qq: r.quantile(qq) for qq in q})                                                                                                                                                   
CPU times: user 343 ms, sys: 21 ms, total: 364 ms
Wall time: 372 ms

In [6]: pd.__version__                                                                                                                                                                                             
Out[6]: '1.0.5'

```
@cottrell sorry for letting this PR sit dormant for a while. Mind fixing up the merge conflict? We had a large overhaul on the rolling code recently.
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.
@cottrell can you rebase (a lot has changed recently). i think this is an interesting PR
Thanks but going to close this PR as stale. Please ping if you'd like to continue working on this.