Skip to content

Commit

Permalink
CLN: use dtype in constructor (pandas-dev#25098)
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 authored and Pingviinituutti committed Feb 28, 2019
1 parent 10620d2 commit 6cb8e1e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 6cb8e1e

Please sign in to comment.