Skip to content

Commit 4b06ae4

Browse files
committed
REF: Created pandas.core.arrays
Moved pandas.core.categorical to arrays.
1 parent 4ebdc50 commit 4b06ae4

File tree

20 files changed

+27
-25
lines changed

20 files changed

+27
-25
lines changed

pandas/_libs/parsers.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ from pandas.core.dtypes.common import (
5555
is_bool_dtype, is_object_dtype,
5656
is_datetime64_dtype,
5757
pandas_dtype)
58-
from pandas.core.categorical import Categorical
58+
from pandas.core.arrays import Categorical
5959
from pandas.core.dtypes.concat import union_categoricals
6060
import pandas.io.common as com
6161

pandas/core/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from pandas.core.algorithms import factorize, unique, value_counts
88
from pandas.core.dtypes.missing import isna, isnull, notna, notnull
9-
from pandas.core.categorical import Categorical
9+
from pandas.core.arrays import Categorical
1010
from pandas.core.groupby import Grouper
1111
from pandas.io.formats.format import set_eng_float_format
1212
from pandas.core.index import (Index, CategoricalIndex, Int64Index,

pandas/core/arrays/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .categorical import Categorical
File renamed without changes.

pandas/core/dtypes/concat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def union_categoricals(to_union, sort_categories=False, ignore_order=False):
314314
Categories (3, object): [b, c, a]
315315
"""
316316
from pandas import Index, Categorical, CategoricalIndex, Series
317-
from pandas.core.categorical import _recode_for_categories
317+
from pandas.core.arrays.categorical import _recode_for_categories
318318

319319
if len(to_union) == 0:
320320
raise ValueError('No Categoricals to union')

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
create_block_manager_from_arrays,
7878
create_block_manager_from_blocks)
7979
from pandas.core.series import Series
80-
from pandas.core.categorical import Categorical
80+
from pandas.core.arrays import Categorical
8181
import pandas.core.algorithms as algorithms
8282
from pandas.compat import (range, map, zip, lrange, lmap, lzip, StringIO, u,
8383
OrderedDict, raise_with_traceback)

pandas/core/groupby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
DataError, SpecificationError)
4848
from pandas.core.index import (Index, MultiIndex,
4949
CategoricalIndex, _ensure_index)
50-
from pandas.core.categorical import Categorical
50+
from pandas.core.arrays import Categorical
5151
from pandas.core.frame import DataFrame
5252
from pandas.core.generic import NDFrame, _shared_docs
5353
from pandas.core.internals import BlockManager, make_block

pandas/core/indexes/category.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _create_from_codes(self, codes, categories=None, ordered=None,
125125
CategoricalIndex
126126
"""
127127

128-
from pandas.core.categorical import Categorical
128+
from pandas.core.arrays import Categorical
129129
if categories is None:
130130
categories = self.categories
131131
if ordered is None:
@@ -162,7 +162,7 @@ def _create_categorical(self, data, categories=None, ordered=None,
162162
if not isinstance(data, ABCCategorical):
163163
if ordered is None and dtype is None:
164164
ordered = False
165-
from pandas.core.categorical import Categorical
165+
from pandas.core.arrays import Categorical
166166
data = Categorical(data, categories=categories, ordered=ordered,
167167
dtype=dtype)
168168
else:
@@ -462,7 +462,7 @@ def where(self, cond, other=None):
462462
other = self._na_value
463463
values = np.where(cond, self.values, other)
464464

465-
from pandas.core.categorical import Categorical
465+
from pandas.core.arrays import Categorical
466466
cat = Categorical(values,
467467
categories=self.categories,
468468
ordered=self.ordered)
@@ -775,7 +775,7 @@ def _delegate_method(self, name, *args, **kwargs):
775775
def _add_accessors(cls):
776776
""" add in Categorical accessor methods """
777777

778-
from pandas.core.categorical import Categorical
778+
from pandas.core.arrays import Categorical
779779
CategoricalIndex._add_delegate_accessors(
780780
delegate=Categorical, accessors=["rename_categories",
781781
"reorder_categories",

pandas/core/indexes/multi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ def from_arrays(cls, arrays, sortorder=None, names=None):
11821182
if len(arrays[i]) != len(arrays[i - 1]):
11831183
raise ValueError('all arrays must be same length')
11841184

1185-
from pandas.core.categorical import _factorize_from_iterables
1185+
from pandas.core.arrays.categorical import _factorize_from_iterables
11861186

11871187
labels, levels = _factorize_from_iterables(arrays)
11881188
if names is None:
@@ -1276,7 +1276,7 @@ def from_product(cls, iterables, sortorder=None, names=None):
12761276
MultiIndex.from_arrays : Convert list of arrays to MultiIndex
12771277
MultiIndex.from_tuples : Convert list of tuples to MultiIndex
12781278
"""
1279-
from pandas.core.categorical import _factorize_from_iterables
1279+
from pandas.core.arrays.categorical import _factorize_from_iterables
12801280
from pandas.core.reshape.util import cartesian_product
12811281

12821282
if not is_list_like(iterables):
@@ -1749,7 +1749,7 @@ def _get_labels_for_sorting(self):
17491749
for sorting, where we need to disambiguate that -1 is not
17501750
a valid valid
17511751
"""
1752-
from pandas.core.categorical import Categorical
1752+
from pandas.core.arrays import Categorical
17531753

17541754
def cats(label):
17551755
return np.arange(np.array(label).max() + 1 if len(label) else 0,

pandas/core/internals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
from pandas.core.index import Index, MultiIndex, _ensure_index
6161
from pandas.core.indexing import maybe_convert_indices, length_of_indexer
62-
from pandas.core.categorical import Categorical, _maybe_to_categorical
62+
from pandas.core.arrays.categorical import Categorical, _maybe_to_categorical
6363
from pandas.core.indexes.datetimes import DatetimeIndex
6464
from pandas.io.formats.printing import pprint_thing
6565

0 commit comments

Comments
 (0)