Skip to content

Commit 31d4d62

Browse files
committed
Move CI imports
1 parent 032cdfd commit 31d4d62

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

pandas/core/indexes/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ def _to_embed(self, keep_tz=False, dtype=None):
10541054
@Appender(_index_shared_docs['astype'])
10551055
def astype(self, dtype, copy=True):
10561056
if is_categorical_dtype(dtype):
1057-
from pandas.core.indexes.category import CategoricalIndex
1057+
from .category import CategoricalIndex
10581058
return CategoricalIndex(self.values, name=self.name, dtype=dtype,
10591059
copy=copy)
10601060
return Index(self.values.astype(dtype, copy=copy), name=self.name,

pandas/core/indexes/datetimes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from pandas.core.algorithms import checked_add_with_arr
3737

3838
from pandas.core.indexes.base import Index, _index_shared_docs
39+
from pandas.core.indexes.category import CategoricalIndex
3940
from pandas.core.indexes.numeric import Int64Index, Float64Index
4041
import pandas.compat as compat
4142
from pandas.tseries.frequencies import (
@@ -918,7 +919,6 @@ def astype(self, dtype, copy=True):
918919
return self.copy()
919920
return self
920921
elif is_categorical_dtype(dtype):
921-
from pandas.core.indexes.category import CategoricalIndex
922922
return CategoricalIndex(self.values, name=self.name, dtype=dtype,
923923
copy=copy)
924924
elif is_string_dtype(dtype):

pandas/core/indexes/interval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
Interval, IntervalMixin, IntervalTree,
3030
intervals_to_interval_bounds)
3131

32+
from pandas.core.indexes.category import CategoricalIndex
3233
from pandas.core.indexes.datetimes import date_range
3334
from pandas.core.indexes.timedeltas import timedelta_range
3435
from pandas.core.indexes.multi import MultiIndex
@@ -632,7 +633,6 @@ def astype(self, dtype, copy=True):
632633
elif is_object_dtype(dtype):
633634
return Index(self.values, dtype=object)
634635
elif is_categorical_dtype(dtype):
635-
from pandas.core.indexes.category import CategoricalIndex
636636
return CategoricalIndex(self.values, name=self.name, dtype=dtype,
637637
copy=copy)
638638
raise ValueError('Cannot cast IntervalIndex to dtype {dtype}'

pandas/core/indexes/numeric.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from pandas.core import algorithms
1818
from pandas.core.indexes.base import (
1919
Index, InvalidIndexError, _index_shared_docs)
20+
from pandas.core.indexes.category import CategoricalIndex
2021
from pandas.util._decorators import Appender, cache_readonly
2122
import pandas.core.dtypes.concat as _concat
2223
import pandas.core.indexes.base as ibase
@@ -315,7 +316,6 @@ def astype(self, dtype, copy=True):
315316
elif is_object_dtype(dtype):
316317
values = self._values.astype('object', copy=copy)
317318
elif is_categorical_dtype(dtype):
318-
from pandas.core.indexes.category import CategoricalIndex
319319
return CategoricalIndex(self, name=self.name, dtype=dtype,
320320
copy=copy)
321321
else:

pandas/core/indexes/period.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import pandas.tseries.frequencies as frequencies
2626
from pandas.tseries.frequencies import get_freq_code as _gfc
27+
from pandas.core.indexes.category import CategoricalIndex
2728
from pandas.core.indexes.datetimes import DatetimeIndex, Int64Index, Index
2829
from pandas.core.indexes.timedeltas import TimedeltaIndex
2930
from pandas.core.indexes.datetimelike import DatelikeOps, DatetimeIndexOpsMixin
@@ -519,7 +520,6 @@ def astype(self, dtype, copy=True, how='start'):
519520
elif is_period_dtype(dtype):
520521
return self.asfreq(freq=dtype.freq)
521522
elif is_categorical_dtype(dtype):
522-
from pandas.core.indexes.category import CategoricalIndex
523523
return CategoricalIndex(self.values, name=self.name, dtype=dtype,
524524
copy=copy)
525525
raise TypeError('Cannot cast PeriodIndex to dtype %s' % dtype)

pandas/core/indexes/timedeltas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from pandas.core.common import _maybe_box, _values_from_object
2121

2222
from pandas.core.indexes.base import Index
23+
from pandas.core.indexes.category import CategoricalIndex
2324
from pandas.core.indexes.numeric import Int64Index
2425
import pandas.compat as compat
2526
from pandas.compat import u
@@ -501,7 +502,6 @@ def astype(self, dtype, copy=True):
501502
return Index(self.values.astype('i8', copy=copy), dtype='i8',
502503
name=self.name)
503504
elif is_categorical_dtype(dtype):
504-
from pandas.core.indexes.category import CategoricalIndex
505505
return CategoricalIndex(self.values, name=self.name, dtype=dtype,
506506
copy=copy)
507507
raise TypeError('Cannot cast TimedeltaIndex to dtype %s' % dtype)

0 commit comments

Comments
 (0)