File tree 1 file changed +16
-12
lines changed
1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change 5
5
import numpy as np
6
6
import pandas ._libs .tslib as tslib
7
7
from pandas import compat
8
- from pandas .core .algorithms import take_1d
9
- from . common import ( is_categorical_dtype ,
10
- is_sparse ,
11
- is_datetimetz ,
12
- is_datetime64_dtype ,
13
- is_timedelta64_dtype ,
14
- is_period_dtype ,
15
- is_object_dtype ,
16
- is_bool_dtype ,
17
- is_dtype_equal ,
18
- _NS_DTYPE ,
19
- _TD_DTYPE )
8
+ from pandas .core .typed . common import (
9
+ is_categorical_dtype ,
10
+ is_sparse ,
11
+ is_datetimetz ,
12
+ is_datetime64_dtype ,
13
+ is_timedelta64_dtype ,
14
+ is_period_dtype ,
15
+ is_object_dtype ,
16
+ is_bool_dtype ,
17
+ is_dtype_equal ,
18
+ _NS_DTYPE ,
19
+ _TD_DTYPE )
20
20
from pandas .core .typed .generic import (
21
21
ABCDatetimeIndex , ABCTimedeltaIndex ,
22
22
ABCPeriodIndex )
@@ -277,6 +277,8 @@ def _maybe_unwrap(x):
277
277
if sort_categories and not categories .is_monotonic_increasing :
278
278
categories = categories .sort_values ()
279
279
indexer = categories .get_indexer (first .categories )
280
+
281
+ from pandas .core .algorithms import take_1d
280
282
new_codes = take_1d (indexer , new_codes , fill_value = - 1 )
281
283
elif ignore_order or all (not c .ordered for c in to_union ):
282
284
# different categories - union and recode
@@ -289,6 +291,8 @@ def _maybe_unwrap(x):
289
291
for c in to_union :
290
292
if len (c .categories ) > 0 :
291
293
indexer = categories .get_indexer (c .categories )
294
+
295
+ from pandas .core .algorithms import take_1d
292
296
new_codes .append (take_1d (indexer , c .codes , fill_value = - 1 ))
293
297
else :
294
298
# must be all NaN
You can’t perform that action at this time.
0 commit comments