ENH: pivot/groupby index with nan (GH3729)
Adds the ability to use NaN as a grouping variable. Required allowing NA as a factorisation variable in `factorize()`.

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