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.