PERF: removed coercion to int64 in Categorical.from_codes
- [x] closes #18501
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry
Since this is performance related - is there an ASV for this? If not can you add and post result? Different solution needed; removing coercion causes type errors with reduce operations. @fivemok could you post more details about the issues? Future contributors trying to fix this would appreciate it. @TomAugspurger apologies for the lack of details. The `from_codes` function can take arrays of non-numeric types which is coerced to an array of `np.int64`. Removing coercion completely can break NumPy reduction operations like `np.max` due to array having a flexible type. I think only removing coercion for arrays of numeric dtype will work. I'll create a new PR after running the tests.

@WillAyd should the full ASV be posted or just for `pd.Categoricals`? @fivemok just for `pd.Categoricals` and the relevant method(s) @WillAyd @TomAugspurger I created a new PR [here](https://github.com/pandas-dev/pandas/pull/21000) for this issue. 