From 783a6dd8417230d466d205a43abf79df1cad2af7 Mon Sep 17 00:00:00 2001 From: tp Date: Sat, 2 Feb 2019 23:18:26 +0000 Subject: [PATCH] CLN: use dtype in constructor --- pandas/core/arrays/categorical.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 35b662eaae9a5..6259ead5ed93e 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -2321,8 +2321,7 @@ def _values_for_factorize(self): @classmethod def _from_factorized(cls, uniques, original): return original._constructor(original.categories.take(uniques), - categories=original.categories, - ordered=original.ordered) + dtype=original.dtype) def equals(self, other): """ @@ -2674,9 +2673,7 @@ def _factorize_from_iterable(values): if is_categorical(values): if isinstance(values, (ABCCategoricalIndex, ABCSeries)): values = values._values - categories = CategoricalIndex(values.categories, - categories=values.categories, - ordered=values.ordered) + categories = CategoricalIndex(values.categories, dtype=values.dtype) codes = values.codes else: # The value of ordered is irrelevant since we don't use cat as such,