BUG: Copy categorical codes if empty (fixes #18051)
In [agreement with @ghasemnaddaf](https://github.com/pandas-dev/pandas/pull/18279#issuecomment-346488176) , I've finished up his PR #18279 (added correct tests). Is it time still to get this into v0.21.1?

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