Untangle reshape imports --> Define pivot_table in DataFrame
State: closed

This is an _alternative_ to #17174.  This is ultimately a better solution to the issue there, but involves a more invasive refactoring.

To recap:

- Right now `DataFrame.pivot_table` is defined in `core.reshape.pivot` with `DataFrame.pivot_table = pivot_table`.  The original and main goal of this (and #17174) is to avoid that, and instead define `DataFrame.pivot_table` within the `DataFrame` class definition.

- Doing this makes the docstrings tricky, since we want `pivot_table.__doc__` to be shared by `reshape.pivot.pivot_table` and `DataFrame.pivot_table`.  To resolve this cleanly, we need to import `reshape.pivot` at the top of `core.frame`.  Doing this requires getting the import of `DataFrame` out of `reshape.pivot` (and anything else it imports, namely `reshape.concat`).


Bonus: If/when this is approved, all of the mid-module imports of `reshape.concat` can be moved to the top of `core.frame`, and a handful of other docstrings can be put into `_shared_docs` in more convenient locations.

Bonus 2: If/when this is approved, doing the same thing in `reshape.merge` and `reshape.tile` is very easy.  `reshape.reshape` is doable but take a bit more work.

- [ ] closes #xxxx
- [ ] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Clean

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=h1) Report
> Merging [#17215](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/f165b90ed27487287e1c8a0a6c4e66344b2c731d?src=pr&el=desc) will **decrease** coverage by `0.04%`.
> The diff coverage is `97.36%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17215      +/-   ##
==========================================
- Coverage   91.02%   90.98%   -0.05%     
==========================================
  Files         162      162              
  Lines       49517    49539      +22     
==========================================
  Hits        45075    45075              
- Misses       4442     4464      +22
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.77% <97.36%> (-0.03%)` | :arrow_down: |
| #single | `40.26% <47.36%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/reshape/concat.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9jb25jYXQucHk=) | `97.67% <100%> (+0.04%)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.72% <100%> (-0.1%)` | :arrow_down: |
| [pandas/core/reshape/pivot.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9waXZvdC5weQ==) | `95.16% <95%> (-0.15%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `63.23% <0%> (-1.82%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17215?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/17215?src=pr&el=footer). Last update [f165b90...2299fd2](https://codecov.io/gh/pandas-dev/pandas/pull/17215?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/17215?src=pr&el=h1) Report
> Merging [#17215](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/f165b90ed27487287e1c8a0a6c4e66344b2c731d?src=pr&el=desc) will **decrease** coverage by `0.04%`.
> The diff coverage is `97.36%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17215      +/-   ##
==========================================
- Coverage   91.02%   90.98%   -0.05%     
==========================================
  Files         162      162              
  Lines       49517    49539      +22     
==========================================
  Hits        45075    45075              
- Misses       4442     4464      +22
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.77% <97.36%> (-0.03%)` | :arrow_down: |
| #single | `40.26% <47.36%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/reshape/concat.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9jb25jYXQucHk=) | `97.67% <100%> (+0.04%)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.72% <100%> (-0.1%)` | :arrow_down: |
| [pandas/core/reshape/pivot.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9waXZvdC5weQ==) | `95.16% <95%> (-0.15%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `63.23% <0%> (-1.82%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17215?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/17215?src=pr&el=footer). Last update [f165b90...2299fd2](https://codecov.io/gh/pandas-dev/pandas/pull/17215?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/17215?src=pr&el=h1) Report
> Merging [#17215](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/f165b90ed27487287e1c8a0a6c4e66344b2c731d?src=pr&el=desc) will **decrease** coverage by `0.04%`.
> The diff coverage is `97.36%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17215      +/-   ##
==========================================
- Coverage   91.02%   90.98%   -0.05%     
==========================================
  Files         162      162              
  Lines       49517    49539      +22     
==========================================
  Hits        45075    45075              
- Misses       4442     4464      +22
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.77% <97.36%> (-0.03%)` | :arrow_down: |
| #single | `40.26% <47.36%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.72% <100%> (-0.1%)` | :arrow_down: |
| [pandas/core/reshape/concat.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9jb25jYXQucHk=) | `97.67% <100%> (+0.04%)` | :arrow_up: |
| [pandas/core/reshape/pivot.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9waXZvdC5weQ==) | `95.16% <95%> (-0.15%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/17215?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `63.23% <0%> (-1.82%)` | :arrow_down: |

------

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

I like the other soln better. This is going backwards.