REF: Simplify quantile, remove reduction from BlockManager
State: closed

BlockManager.reduction is only ever called for quantile.  Might as well remove the layer of indirection so we can simplify reduction (now renamed quantile).  Most of the simplification comes in Block.quantile, since we can avoid passing around things we don't need.

Two nested functions currently defined inside Block.quantile are moved outside the closure so I don't have to double-check the namespace every time I look at them.  Not sure if they belong somewhere else.

Labels:
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations
name: Clean

Comments:
just moved + pushed.  hopefully I'll get the docstrings in place before you have to remind me.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24597?src=pr&el=h1) Report
> Merging [#24597](https://codecov.io/gh/pandas-dev/pandas/pull/24597?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/62506ca3c37b6b0d84833a8329e50c000316250e?src=pr&el=desc) will **decrease** coverage by `49.34%`.
> The diff coverage is `9.8%`.

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

```diff
@@             Coverage Diff             @@
##           master   #24597       +/-   ##
===========================================
- Coverage   92.38%   43.04%   -49.35%     
===========================================
  Files         166      166               
  Lines       52478    52481        +3     
===========================================
- Hits        48483    22591    -25892     
- Misses       3995    29890    +25895
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `?` | |
| #single | `43.04% <9.8%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24597?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/internals/blocks.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2Jsb2Nrcy5weQ==) | `52.82% <10%> (-41.68%)` | :arrow_down: |
| [pandas/core/nanops.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvbmFub3BzLnB5) | `31.27% <10%> (-63.64%)` | :arrow_down: |
| [pandas/core/internals/managers.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL21hbmFnZXJzLnB5) | `66.22% <9.09%> (-29.71%)` | :arrow_down: |
| [pandas/io/formats/latex.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvbGF0ZXgucHk=) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/core/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY2F0ZWdvcmljYWwucHk=) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/io/sas/sas\_constants.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nhcy9zYXNfY29uc3RhbnRzLnB5) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/tseries/plotting.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvcGxvdHRpbmcucHk=) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/tseries/converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvY29udmVydGVyLnB5) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/io/formats/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvaHRtbC5weQ==) | `0% <0%> (-99.37%)` | :arrow_down: |
| [pandas/core/groupby/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS9jYXRlZ29yaWNhbC5weQ==) | `0% <0%> (-95.46%)` | :arrow_down: |
| ... and [127 more](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree-more) | |

------

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

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24597?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@5ba4337`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `94.11%`.

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

```diff
@@            Coverage Diff            @@
##             master   #24597   +/-   ##
=========================================
  Coverage          ?   92.38%           
=========================================
  Files             ?      166           
  Lines             ?    52488           
  Branches          ?        0           
=========================================
  Hits              ?    48491           
  Misses            ?     3997           
  Partials          ?        0
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.81% <94.11%> (?)` | |
| #single | `43.05% <9.8%> (?)` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24597?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/internals/managers.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL21hbmFnZXJzLnB5) | `95.96% <100%> (ø)` | |
| [pandas/core/internals/blocks.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2Jsb2Nrcy5weQ==) | `94.54% <100%> (ø)` | |
| [pandas/core/nanops.py](https://codecov.io/gh/pandas-dev/pandas/pull/24597/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvbmFub3BzLnB5) | `94.54% <85%> (ø)` | |

------

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

one more quantile PR in the pipeline after this
ping on green. followup to clean internals very welcome!
thanks @jbrockmendel