ERR: Fix segfault with .astype('category') on empty DataFrame
- [X] closes #18004
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry

Credit to @cgohlke for determining the fix.
lgtm. ping on green. 

if you *are* looking for things to work on #12860 is interesting. # [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18015?src=pr&el=h1) Report
> Merging [#18015](https://codecov.io/gh/pandas-dev/pandas/pull/18015?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/b2d0d1bfe578ce91d545bd2f806655d0bf497440?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #18015      +/-   ##
==========================================
- Coverage   91.23%   91.22%   -0.02%     
==========================================
  Files         163      163              
  Lines       50091    50091              
==========================================
- Hits        45703    45695       -8     
- Misses       4388     4396       +8
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.03% <ø> (ø)` | :arrow_up: |
| #single | `40.24% <ø> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18015?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18015?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18015?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.75% <0%> (-0.1%)` | :arrow_down: |
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/18015?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `92.84% <0%> (+0.04%)` | :arrow_up: |

------

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

Will look into the issue you referenced, seems interesting. thanks @jschendel 