Skip to content

Commit bbc6e30

Browse files
committed
CLN: move pandas.types -> pandas.core.types
xref #13634
1 parent 614a48e commit bbc6e30

File tree

131 files changed

+716
-629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+716
-629
lines changed

asv_bench/benchmarks/categoricals.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .pandas_vb_common import *
22
try:
3-
from pandas.types.concat import union_categoricals
3+
from pandas.core.types.concat import union_categoricals
44
except ImportError:
55
pass
66

doc/source/whatsnew/v0.20.0.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -1000,12 +1000,13 @@ New Behavior:
10001000
In [11]: index.memory_usage(deep=True)
10011001
Out[11]: 260
10021002

1003-
.. _whatsnew_0200.api_breaking.extensions:
1003+
.. _whatsnew_0200.api_breaking.privacy:
10041004

1005-
Extension Modules Moved
1006-
^^^^^^^^^^^^^^^^^^^^^^^
1005+
Modules Privacy Has Changed
1006+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
10071007

1008-
Some formerly public c/c++/cython extension modules have been moved and/or renamed. These are all removed from the public API.
1008+
Some formerly public python/c/c++/cython extension modules have been moved and/or renamed. These are all removed from the public API.
1009+
Further more, the ``pandas.core``, ``pandas.io``, and ``pandas.util`` top-level modules are now considered to be PRIVATE.
10091010
If indicated, a deprecation warning will be issued if you reference that module. (:issue:`12588`)
10101011

10111012
.. csv-table::
@@ -1022,6 +1023,7 @@ If indicated, a deprecation warning will be issued if you reference that module.
10221023
"pandas.hashtable", "pandas._libs.hashtable", ""
10231024
"pandas.json", "pandas.io.json.libjson", "X"
10241025
"pandas.parser", "pandas.io.libparsers", "X"
1026+
"pandas.types", "pandas.core.types", ""
10251027
"pandas.io.sas.saslib", "pandas.io.sas.libsas", ""
10261028
"pandas._testing", "pandas.util.libtesting", ""
10271029
"pandas._sparse", "pandas.sparse.libsparse", ""

pandas/api/types/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
""" public toolkit API """
22

3-
from pandas.types.api import * # noqa
3+
from pandas.core.types.api import * # noqa
44
del np # noqa

pandas/compat/numpy/function.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from pandas.util.validators import (validate_args, validate_kwargs,
2323
validate_args_and_kwargs)
2424
from pandas.errors import UnsupportedFunctionCall
25-
from pandas.types.common import is_integer, is_bool
25+
from pandas.core.types.common import is_integer, is_bool
2626
from pandas.compat import OrderedDict
2727

2828

pandas/computation/ops.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import numpy as np
99

10-
from pandas.types.common import is_list_like, is_scalar
10+
from pandas.core.types.common import is_list_like, is_scalar
1111
import pandas as pd
1212
from pandas.compat import PY3, string_types, text_type
1313
import pandas.core.common as com

pandas/computation/pytables.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66
import pandas as pd
77

8-
from pandas.types.common import is_list_like
8+
from pandas.core.types.common import is_list_like
99
import pandas.core.common as com
1010
from pandas.compat import u, string_types, DeepChainMap
1111
from pandas.core.base import StringMixin

pandas/core/algorithms.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
import numpy as np
88

99
from pandas import compat, _np_version_under1p8
10-
from pandas.types.cast import maybe_promote
11-
from pandas.types.generic import (ABCSeries, ABCIndex,
12-
ABCIndexClass, ABCCategorical)
13-
from pandas.types.common import (
10+
from pandas.core.types.cast import maybe_promote
11+
from pandas.core.types.generic import (
12+
ABCSeries, ABCIndex,
13+
ABCIndexClass, ABCCategorical)
14+
from pandas.core.types.common import (
1415
is_unsigned_integer_dtype, is_signed_integer_dtype,
1516
is_integer_dtype, is_complex_dtype,
1617
is_categorical_dtype, is_sparse,
@@ -25,7 +26,7 @@
2526
_ensure_float64, _ensure_uint64,
2627
_ensure_int64)
2728
from pandas.compat.numpy import _np_version_under1p10
28-
from pandas.types.missing import isnull
29+
from pandas.core.types.missing import isnull
2930

3031
import pandas.core.common as com
3132
from pandas.compat import string_types

pandas/core/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66

77
from pandas.core.algorithms import factorize, unique, value_counts
8-
from pandas.types.missing import isnull, notnull
8+
from pandas.core.types.missing import isnull, notnull
99
from pandas.core.categorical import Categorical
1010
from pandas.core.groupby import Grouper
1111
from pandas.formats.format import set_eng_float_format

pandas/core/base.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
from pandas.compat import builtins
77
import numpy as np
88

9-
from pandas.types.missing import isnull
10-
from pandas.types.generic import ABCDataFrame, ABCSeries, ABCIndexClass
11-
from pandas.types.common import is_object_dtype, is_list_like, is_scalar
9+
from pandas.core.types.missing import isnull
10+
from pandas.core.types.generic import ABCDataFrame, ABCSeries, ABCIndexClass
11+
from pandas.core.types.common import is_object_dtype, is_list_like, is_scalar
1212
from pandas.util.validators import validate_bool_kwarg
1313

1414
from pandas.core import common as com
@@ -725,7 +725,7 @@ def _aggregate_multiple_funcs(self, arg, _level, _axis):
725725
# we are concatting non-NDFrame objects,
726726
# e.g. a list of scalars
727727

728-
from pandas.types.cast import is_nested_object
728+
from pandas.core.types.cast import is_nested_object
729729
from pandas import Series
730730
result = Series(results, index=keys, name=self.name)
731731
if is_nested_object(result):

pandas/core/categorical.py

+19-16
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,24 @@
88
from pandas.compat import u, lzip
99
from pandas._libs import lib, algos as libalgos
1010

11-
from pandas.types.generic import ABCSeries, ABCIndexClass, ABCCategoricalIndex
12-
from pandas.types.missing import isnull, notnull
13-
from pandas.types.cast import (maybe_infer_to_datetimelike,
14-
coerce_indexer_dtype)
15-
from pandas.types.dtypes import CategoricalDtype
16-
from pandas.types.common import (_ensure_int64,
17-
_ensure_object,
18-
_ensure_platform_int,
19-
is_dtype_equal,
20-
is_datetimelike,
21-
is_categorical,
22-
is_categorical_dtype,
23-
is_integer_dtype, is_bool,
24-
is_list_like, is_sequence,
25-
is_scalar)
11+
from pandas.core.types.generic import (
12+
ABCSeries, ABCIndexClass, ABCCategoricalIndex)
13+
from pandas.core.types.missing import isnull, notnull
14+
from pandas.core.types.cast import (
15+
maybe_infer_to_datetimelike,
16+
coerce_indexer_dtype)
17+
from pandas.core.types.dtypes import CategoricalDtype
18+
from pandas.core.types.common import (
19+
_ensure_int64,
20+
_ensure_object,
21+
_ensure_platform_int,
22+
is_dtype_equal,
23+
is_datetimelike,
24+
is_categorical,
25+
is_categorical_dtype,
26+
is_integer_dtype, is_bool,
27+
is_list_like, is_sequence,
28+
is_scalar)
2629
from pandas.core.common import is_null_slice
2730

2831
from pandas.core.algorithms import factorize, take_1d, unique1d
@@ -1215,7 +1218,7 @@ def value_counts(self, dropna=True):
12151218
12161219
"""
12171220
from numpy import bincount
1218-
from pandas.types.missing import isnull
1221+
from pandas.core.types.missing import isnull
12191222
from pandas.core.series import Series
12201223
from pandas.core.index import CategoricalIndex
12211224

pandas/core/common.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
from pandas import compat
1414
from pandas.compat import long, zip, iteritems
1515
from pandas.core.config import get_option
16-
from pandas.types.generic import ABCSeries
17-
from pandas.types.common import _NS_DTYPE
18-
from pandas.types.inference import _iterable_not_string
19-
from pandas.types.missing import isnull
16+
from pandas.core.types.generic import ABCSeries
17+
from pandas.core.types.common import _NS_DTYPE
18+
from pandas.core.types.inference import _iterable_not_string
19+
from pandas.core.types.missing import isnull
2020
from pandas.api import types
21-
from pandas.types import common
21+
from pandas.core.types import common
2222

2323
# compat
2424
from pandas.errors import ( # noqa
@@ -60,7 +60,7 @@ def wrapper(*args, **kwargs):
6060
warnings.warn("pandas.core.common.{t} is deprecated. "
6161
"These are not longer public API functions, "
6262
"but can be imported from "
63-
"pandas.types.common.{t} instead".format(t=t),
63+
"pandas.core.types.common.{t} instead".format(t=t),
6464
DeprecationWarning, stacklevel=3)
6565
return getattr(common, t)(*args, **kwargs)
6666
return wrapper
@@ -73,7 +73,7 @@ def wrapper(*args, **kwargs):
7373
def array_equivalent(*args, **kwargs):
7474
warnings.warn("'pandas.core.common.array_equivalent' is deprecated and "
7575
"is no longer public API", DeprecationWarning, stacklevel=2)
76-
from pandas.types import missing
76+
from pandas.core.types import missing
7777
return missing.array_equivalent(*args, **kwargs)
7878

7979

pandas/core/config_init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def mpl_style_cb(key):
415415

416416

417417
def use_inf_as_null_cb(key):
418-
from pandas.types.missing import _use_inf_as_null
418+
from pandas.core.types.missing import _use_inf_as_null
419419
_use_inf_as_null(key)
420420

421421

pandas/core/frame.py

+34-32
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,40 @@
2323
import numpy as np
2424
import numpy.ma as ma
2525

26-
from pandas.types.cast import (maybe_upcast, infer_dtype_from_scalar,
27-
maybe_cast_to_datetime,
28-
maybe_infer_to_datetimelike,
29-
maybe_convert_platform,
30-
maybe_downcast_to_dtype,
31-
invalidate_string_dtypes,
32-
coerce_to_dtypes,
33-
maybe_upcast_putmask,
34-
find_common_type)
35-
from pandas.types.common import (is_categorical_dtype,
36-
is_object_dtype,
37-
is_extension_type,
38-
is_datetimetz,
39-
is_datetime64_any_dtype,
40-
is_datetime64tz_dtype,
41-
is_bool_dtype,
42-
is_integer_dtype,
43-
is_float_dtype,
44-
is_integer,
45-
is_scalar,
46-
is_dtype_equal,
47-
needs_i8_conversion,
48-
_get_dtype_from_object,
49-
_ensure_float,
50-
_ensure_float64,
51-
_ensure_int64,
52-
_ensure_platform_int,
53-
is_list_like,
54-
is_iterator,
55-
is_sequence,
56-
is_named_tuple)
57-
from pandas.types.missing import isnull, notnull
26+
from pandas.core.types.cast import (
27+
maybe_upcast, infer_dtype_from_scalar,
28+
maybe_cast_to_datetime,
29+
maybe_infer_to_datetimelike,
30+
maybe_convert_platform,
31+
maybe_downcast_to_dtype,
32+
invalidate_string_dtypes,
33+
coerce_to_dtypes,
34+
maybe_upcast_putmask,
35+
find_common_type)
36+
from pandas.core.types.common import (
37+
is_categorical_dtype,
38+
is_object_dtype,
39+
is_extension_type,
40+
is_datetimetz,
41+
is_datetime64_any_dtype,
42+
is_datetime64tz_dtype,
43+
is_bool_dtype,
44+
is_integer_dtype,
45+
is_float_dtype,
46+
is_integer,
47+
is_scalar,
48+
is_dtype_equal,
49+
needs_i8_conversion,
50+
_get_dtype_from_object,
51+
_ensure_float,
52+
_ensure_float64,
53+
_ensure_int64,
54+
_ensure_platform_int,
55+
is_list_like,
56+
is_iterator,
57+
is_sequence,
58+
is_named_tuple)
59+
from pandas.core.types.missing import isnull, notnull
5860

5961
from pandas.core.common import (_try_sort,
6062
_default_index,

pandas/core/generic.py

+17-16
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,23 @@
1010
import pandas as pd
1111

1212
from pandas._libs import tslib, lib
13-
from pandas.types.common import (_coerce_to_dtype,
14-
_ensure_int64,
15-
needs_i8_conversion,
16-
is_scalar,
17-
is_integer, is_bool,
18-
is_bool_dtype,
19-
is_numeric_dtype,
20-
is_datetime64_dtype,
21-
is_timedelta64_dtype,
22-
is_datetime64tz_dtype,
23-
is_list_like,
24-
is_dict_like,
25-
is_re_compilable)
26-
from pandas.types.cast import maybe_promote, maybe_upcast_putmask
27-
from pandas.types.missing import isnull, notnull
28-
from pandas.types.generic import ABCSeries, ABCPanel
13+
from pandas.core.types.common import (
14+
_coerce_to_dtype,
15+
_ensure_int64,
16+
needs_i8_conversion,
17+
is_scalar,
18+
is_integer, is_bool,
19+
is_bool_dtype,
20+
is_numeric_dtype,
21+
is_datetime64_dtype,
22+
is_timedelta64_dtype,
23+
is_datetime64tz_dtype,
24+
is_list_like,
25+
is_dict_like,
26+
is_re_compilable)
27+
from pandas.core.types.cast import maybe_promote, maybe_upcast_putmask
28+
from pandas.core.types.missing import isnull, notnull
29+
from pandas.core.types.generic import ABCSeries, ABCPanel
2930

3031
from pandas.core.common import (_values_from_object,
3132
_maybe_box_datetimelike,

pandas/core/groupby.py

+22-21
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,27 @@
1515
from pandas.compat.numpy import function as nv, _np_version_under1p8
1616
from pandas.compat import set_function_name
1717

18-
from pandas.types.common import (is_numeric_dtype,
19-
is_timedelta64_dtype, is_datetime64_dtype,
20-
is_categorical_dtype,
21-
is_interval_dtype,
22-
is_datetimelike,
23-
is_datetime64_any_dtype,
24-
is_bool, is_integer_dtype,
25-
is_complex_dtype,
26-
is_bool_dtype,
27-
is_scalar,
28-
is_list_like,
29-
needs_i8_conversion,
30-
_ensure_float64,
31-
_ensure_platform_int,
32-
_ensure_int64,
33-
_ensure_object,
34-
_ensure_categorical,
35-
_ensure_float)
36-
from pandas.types.cast import maybe_downcast_to_dtype
37-
from pandas.types.missing import isnull, notnull, _maybe_fill
18+
from pandas.core.types.common import (
19+
is_numeric_dtype,
20+
is_timedelta64_dtype, is_datetime64_dtype,
21+
is_categorical_dtype,
22+
is_interval_dtype,
23+
is_datetimelike,
24+
is_datetime64_any_dtype,
25+
is_bool, is_integer_dtype,
26+
is_complex_dtype,
27+
is_bool_dtype,
28+
is_scalar,
29+
is_list_like,
30+
needs_i8_conversion,
31+
_ensure_float64,
32+
_ensure_platform_int,
33+
_ensure_int64,
34+
_ensure_object,
35+
_ensure_categorical,
36+
_ensure_float)
37+
from pandas.core.types.cast import maybe_downcast_to_dtype
38+
from pandas.core.types.missing import isnull, notnull, _maybe_fill
3839

3940
from pandas.core.common import (_values_from_object, AbstractMethodError,
4041
_default_index)
@@ -4079,7 +4080,7 @@ def _apply_to_column_groupbys(self, func):
40794080
def count(self):
40804081
""" Compute count of group, excluding missing values """
40814082
from functools import partial
4082-
from pandas.types.missing import _isnull_ndarraylike as isnull
4083+
from pandas.core.types.missing import _isnull_ndarraylike as isnull
40834084

40844085
data, _ = self._get_data_to_aggregate()
40854086
ids, _, ngroups = self.grouper.group_info

0 commit comments

Comments
 (0)