Skip to content

Commit

Permalink
remove circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Apr 15, 2017
1 parent e98e89f commit a85e487
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions pandas/core/typed/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
import numpy as np
import pandas._libs.tslib as tslib
from pandas import compat
from pandas.core.algorithms import take_1d
from .common import (is_categorical_dtype,
is_sparse,
is_datetimetz,
is_datetime64_dtype,
is_timedelta64_dtype,
is_period_dtype,
is_object_dtype,
is_bool_dtype,
is_dtype_equal,
_NS_DTYPE,
_TD_DTYPE)
from pandas.core.typed.common import (
is_categorical_dtype,
is_sparse,
is_datetimetz,
is_datetime64_dtype,
is_timedelta64_dtype,
is_period_dtype,
is_object_dtype,
is_bool_dtype,
is_dtype_equal,
_NS_DTYPE,
_TD_DTYPE)
from pandas.core.typed.generic import (
ABCDatetimeIndex, ABCTimedeltaIndex,
ABCPeriodIndex)
Expand Down Expand Up @@ -277,6 +277,8 @@ def _maybe_unwrap(x):
if sort_categories and not categories.is_monotonic_increasing:
categories = categories.sort_values()
indexer = categories.get_indexer(first.categories)

from pandas.core.algorithms import take_1d
new_codes = take_1d(indexer, new_codes, fill_value=-1)
elif ignore_order or all(not c.ordered for c in to_union):
# different categories - union and recode
Expand All @@ -289,6 +291,8 @@ def _maybe_unwrap(x):
for c in to_union:
if len(c.categories) > 0:
indexer = categories.get_indexer(c.categories)

from pandas.core.algorithms import take_1d
new_codes.append(take_1d(indexer, c.codes, fill_value=-1))
else:
# must be all NaN
Expand Down

0 comments on commit a85e487

Please sign in to comment.