BUG: pivot_table over Categorical Columns
State: closed

 - [x] closes #15193
 - [x] tests added / passed
 - [] passes ``git diff upstream/master | flake8 --diff``
 - [x] whatsnew entry


Labels:
name: Bug
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Categorical
description: Categorical Data Type

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


```diff
@@            Coverage Diff             @@
##           master   #15511      +/-   ##
==========================================
+ Coverage   90.36%   91.08%   +0.71%     
==========================================
  Files         136      136              
  Lines       49553    49101     -452     
==========================================
- Hits        44780    44724      -56     
+ Misses       4773     4377     -396
```


| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/15511?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tools/pivot.py](https://codecov.io/gh/pandas-dev/pandas/compare/b3ae4c7698de4623e1279d579b46192ef79250d1...bf0fdeb2285d778964bf979c5a5c220dd46ee1b3?src=pr&el=tree#diff-cGFuZGFzL3Rvb2xzL3Bpdm90LnB5) | `95.07% <100%> (+0.03%)` | :white_check_mark: |
| [pandas/util/decorators.py](https://codecov.io/gh/pandas-dev/pandas/compare/b3ae4c7698de4623e1279d579b46192ef79250d1...bf0fdeb2285d778964bf979c5a5c220dd46ee1b3?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvZGVjb3JhdG9ycy5weQ==) | `67.32% <0%> (-1.28%)` | :x: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/compare/b3ae4c7698de4623e1279d579b46192ef79250d1...bf0fdeb2285d778964bf979c5a5c220dd46ee1b3?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.73% <0%> (-0.1%)` | :x: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/compare/b3ae4c7698de4623e1279d579b46192ef79250d1...bf0fdeb2285d778964bf979c5a5c220dd46ee1b3?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `82.06% <0%> (-0.04%)` | :x: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/compare/b3ae4c7698de4623e1279d579b46192ef79250d1...bf0fdeb2285d778964bf979c5a5c220dd46ee1b3?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.31% <0%> (ø)` | :white_check_mark: |
| [pandas/util/print_versions.py](https://codecov.io/gh/pandas-dev/pandas/compare/b3ae4c7698de4623e1279d579b46192ef79250d1...bf0fdeb2285d778964bf979c5a5c220dd46ee1b3?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvcHJpbnRfdmVyc2lvbnMucHk=) | `15.71% <0%> (ø)` | :white_check_mark: |
| [pandas/core/groupby.py](https://codecov.io/gh/pandas-dev/pandas/compare/b3ae4c7698de4623e1279d579b46192ef79250d1...bf0fdeb2285d778964bf979c5a5c220dd46ee1b3?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS5weQ==) | `95% <0%> (+0.01%)` | :white_check_mark: |
| [pandas/types/cast.py](https://codecov.io/gh/pandas-dev/pandas/compare/b3ae4c7698de4623e1279d579b46192ef79250d1...bf0fdeb2285d778964bf979c5a5c220dd46ee1b3?src=pr&el=tree#diff-cGFuZGFzL3R5cGVzL2Nhc3QucHk=) | `85.65% <0%> (+0.23%)` | :white_check_mark: |
| [pandas/core/common.py](https://codecov.io/gh/pandas-dev/pandas/compare/b3ae4c7698de4623e1279d579b46192ef79250d1...bf0fdeb2285d778964bf979c5a5c220dd46ee1b3?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tbW9uLnB5) | `91.36% <0%> (+0.33%)` | :white_check_mark: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/compare/b3ae4c7698de4623e1279d579b46192ef79250d1...bf0fdeb2285d778964bf979c5a5c220dd46ee1b3?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `40% <0%> (+23.53%)` | :white_check_mark: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15511?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/15511?src=pr&el=footer). Last update [b3ae4c7...bf0fdeb](https://codecov.io/gh/pandas-dev/pandas/compare/b3ae4c7698de4623e1279d579b46192ef79250d1...bf0fdeb2285d778964bf979c5a5c220dd46ee1b3?el=footer&src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
lgtm. ping on green (a couple of typos, but will fix on merge).
thanks!