ENH GH20601 raise error when pivot table's number of levels > int32
Because the error of number of levels exceeding int32 can happen both in `pivot_table` and `unstack`, I catch the error as early as possible in both places.

Arguments for and against catching the error in `pivot_table`:
- For: `pivot_table` does aggregation before calling `unstack`, so it takes a while before the error is raised
- Against: `pivot_table` ultimately calls `unstack`, so it's not worth it to check for the error in both places

I'm happy to go with either way as you prefer.

- [X ] closes #20601
- [X ] tests added / passed
- [X ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X ] whatsnew entry

Hello @anhqle! Thanks for updating the PR.









Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on July 31, 2018 at 17:22 Hours UTC # [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20784?src=pr&el=h1) Report
> Merging [#20784](https://codecov.io/gh/pandas-dev/pandas/pull/20784?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/c272c52a548d4b75d32857d8b33821a3b0b41187?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `80%`.

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

```diff
@@            Coverage Diff             @@
##           master   #20784      +/-   ##
==========================================
- Coverage   92.07%   92.06%   -0.01%     
==========================================
  Files         170      170              
  Lines       50688    50693       +5     
==========================================
+ Hits        46671    46672       +1     
- Misses       4017     4021       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.47% <80%> (-0.01%)` | :arrow_down: |
| #single | `42.28% <0%> (-0.03%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/20784?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/reshape/pivot.py](https://codecov.io/gh/pandas-dev/pandas/pull/20784/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9waXZvdC5weQ==) | `97.03% <100%> (ø)` | :arrow_up: |
| [pandas/core/reshape/reshape.py](https://codecov.io/gh/pandas-dev/pandas/pull/20784/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9yZXNoYXBlLnB5) | `99.57% <75%> (-0.22%)` | :arrow_down: |
| [pandas/core/dtypes/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/20784/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbW1vbi5weQ==) | `94.87% <0%> (-0.34%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/20784/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `85.69% <0%> (-0.21%)` | :arrow_down: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/20784/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `95.44% <0%> (-0.03%)` | :arrow_down: |
| [pandas/core/dtypes/dtypes.py](https://codecov.io/gh/pandas-dev/pandas/pull/20784/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2R0eXBlcy5weQ==) | `96.05% <0%> (+0.02%)` | :arrow_up: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/20784/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `93.5% <0%> (+0.1%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20784?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/20784?src=pr&el=footer). Last update [c272c52...7e6246c](https://codecov.io/gh/pandas-dev/pandas/pull/20784?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 generally use the original PR and push to it. having a new one is confusing. My apology about creating a new PR. I `pull --rebase upstream master` in the original PR and the diff got polluted by other commits. Am I supposed to `pull --rebase upstream master`, or the maintainers are in charge of the final merge into `master`?

Thanks again for your guidance -- I'm learning my way through the codebase and hope to be an active contributor in the future. your u should rebase against upstream every time you push - it makes it so your code is not out of date wrt to master
but you don’t need to squash Do you think this PR is ready to be merged? Happy to do any additional work. can you rebase can you rebase closing in favor of #23512 