COMPAT: infer_dtype not handling categoricals (GH8974)

closes #8974