BUG: Fix rolling median and quantile with closed='left' and closed='neither' (#26005)
State: closed

- [x] Fixes issues with rolling `median` (and also `quantile`) `closed='left'` and `closed='neither'` in #26005 
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Here is my understanding of how it should work:

*Same as test cases, there is one day between each element and window size is 3 days.

For `closed='both'` (**()** denotes Nth window and **-** is just to state window is out of ):
```
N=0 | (-, -, - [0), 1, 2, 3, 4, 5, 6, 7, 8, 9]
N=1 | -, (-, - [0, 1), 2, 3, 4, 5, 6, 7, 8, 9]
N=2 | -, -, (- [0, 1, 2), 3, 4, 5, 6, 7, 8, 9]
N=3 | -, -, - [(0, 1, 2, 3), 4, 5, 6, 7, 8, 9]
...
```

For `closed='right'`:
```
N=0 | -, (-, - [0), 1, 2, 3, 4, 5, 6, 7, 8, 9]
N=1 | -, -, (- [0, 1), 2, 3, 4, 5, 6, 7, 8, 9]
N=2 | -, -, - [(0, 1, 2), 3, 4, 5, 6, 7, 8, 9]
N=3 | -, -, - [0, (1, 2, 3), 4, 5, 6, 7, 8, 9]
...
```
For `closed='left'`:
```
N=0 | (-, -, -) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
N=1 | -, (-, - [0), 1, 2, 3, 4, 5, 6, 7, 8, 9]
N=2 | -, -, (- [0, 1), 2, 3, 4, 5, 6, 7, 8, 9]
N=3 | -, -, - [(0, 1, 2), 3, 4, 5, 6, 7, 8, 9]
...
```

For `closed='neither'`:
```
N=0 | -, (-, -) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
N=1 | -, -, (- [0), 1, 2, 3, 4, 5, 6, 7, 8, 9]
N=2 | -, -, - [(0, 1), 2, 3, 4, 5, 6, 7, 8, 9]
N=3 | -, -, - [0, (1, 2), 3, 4, 5, 6, 7, 8, 9]
...
```

Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode

Comments:
Thank @ihsansecer. It looks like #26005 reported multiple issues. Do your changes fix the memory skiplist issues? If so, can you add tests / release note? Otherwise, edit the original post to remove the "closes", so that it remains open.

cc @WillAyd
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26910?src=pr&el=h1) Report
> Merging [#26910](https://codecov.io/gh/pandas-dev/pandas/pull/26910?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/b9b081dc6b510c8290ded12fe751b1216843527e?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #26910      +/-   ##
==========================================
- Coverage   91.97%   91.97%   -0.01%     
==========================================
  Files         180      180              
  Lines       50756    50760       +4     
==========================================
  Hits        46685    46685              
- Misses       4071     4075       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.56% <ø> (ø)` | :arrow_up: |
| #single | `41.82% <ø> (-0.09%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26910?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26910/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `88.88% <0%> (-11.12%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26910/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.89% <0%> (-0.12%)` | :arrow_down: |
| [pandas/core/internals/construction.py](https://codecov.io/gh/pandas-dev/pandas/pull/26910/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2NvbnN0cnVjdGlvbi5weQ==) | `95.95% <0%> (+0.02%)` | :arrow_up: |
| [pandas/core/dtypes/cast.py](https://codecov.io/gh/pandas-dev/pandas/pull/26910/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2Nhc3QucHk=) | `90.56% <0%> (+0.03%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26910?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/26910?src=pr&el=footer). Last update [b9b081d...51e89c4](https://codecov.io/gh/pandas-dev/pandas/pull/26910?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

@TomAugspurger not yet checked issues with memory skiplist and `max` function but I am planning to have a look and open another PR. Thanks
It seems `quantile` is also producing unexpected results same as stated in the issue. If there is no problem with this fix I will apply the same to `quantile` function.
yep, can you merge master and push again here.
@jreback Merged and changed `roll_quantile` as mentioned
thanks @ihsansecer nice patch!