Skip to content

Commit

Permalink
CLN: move pandas.types -> pandas.core.typed
Browse files Browse the repository at this point in the history
xref #13634
  • Loading branch information
jreback committed Apr 14, 2017
1 parent 614a48e commit 8044942
Show file tree
Hide file tree
Showing 131 changed files with 716 additions and 629 deletions.
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/categoricals.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .pandas_vb_common import *
try:
from pandas.types.concat import union_categoricals
from pandas.core.types.concat import union_categoricals
except ImportError:
pass

Expand Down
10 changes: 6 additions & 4 deletions doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1000,12 +1000,13 @@ New Behavior:
In [11]: index.memory_usage(deep=True)
Out[11]: 260

.. _whatsnew_0200.api_breaking.extensions:
.. _whatsnew_0200.api_breaking.privacy:

Extension Modules Moved
^^^^^^^^^^^^^^^^^^^^^^^
Modules Privacy Has Changed
^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

.. csv-table::
Expand All @@ -1022,6 +1023,7 @@ If indicated, a deprecation warning will be issued if you reference that module.
"pandas.hashtable", "pandas._libs.hashtable", ""
"pandas.json", "pandas.io.json.libjson", "X"
"pandas.parser", "pandas.io.libparsers", "X"
"pandas.types", "pandas.core.types", ""
"pandas.io.sas.saslib", "pandas.io.sas.libsas", ""
"pandas._testing", "pandas.util.libtesting", ""
"pandas._sparse", "pandas.sparse.libsparse", ""
Expand Down
2 changes: 1 addition & 1 deletion pandas/api/types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" public toolkit API """

from pandas.types.api import * # noqa
from pandas.core.types.api import * # noqa
del np # noqa
2 changes: 1 addition & 1 deletion pandas/compat/numpy/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from pandas.util.validators import (validate_args, validate_kwargs,
validate_args_and_kwargs)
from pandas.errors import UnsupportedFunctionCall
from pandas.types.common import is_integer, is_bool
from pandas.core.types.common import is_integer, is_bool
from pandas.compat import OrderedDict


Expand Down
2 changes: 1 addition & 1 deletion pandas/computation/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import numpy as np

from pandas.types.common import is_list_like, is_scalar
from pandas.core.types.common import is_list_like, is_scalar
import pandas as pd
from pandas.compat import PY3, string_types, text_type
import pandas.core.common as com
Expand Down
2 changes: 1 addition & 1 deletion pandas/computation/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import pandas as pd

from pandas.types.common import is_list_like
from pandas.core.types.common import is_list_like
import pandas.core.common as com
from pandas.compat import u, string_types, DeepChainMap
from pandas.core.base import StringMixin
Expand Down
11 changes: 6 additions & 5 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
import numpy as np

from pandas import compat, _np_version_under1p8
from pandas.types.cast import maybe_promote
from pandas.types.generic import (ABCSeries, ABCIndex,
ABCIndexClass, ABCCategorical)
from pandas.types.common import (
from pandas.core.types.cast import maybe_promote
from pandas.core.types.generic import (
ABCSeries, ABCIndex,
ABCIndexClass, ABCCategorical)
from pandas.core.types.common import (
is_unsigned_integer_dtype, is_signed_integer_dtype,
is_integer_dtype, is_complex_dtype,
is_categorical_dtype, is_sparse,
Expand All @@ -25,7 +26,7 @@
_ensure_float64, _ensure_uint64,
_ensure_int64)
from pandas.compat.numpy import _np_version_under1p10
from pandas.types.missing import isnull
from pandas.core.types.missing import isnull

import pandas.core.common as com
from pandas.compat import string_types
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np

from pandas.core.algorithms import factorize, unique, value_counts
from pandas.types.missing import isnull, notnull
from pandas.core.types.missing import isnull, notnull
from pandas.core.categorical import Categorical
from pandas.core.groupby import Grouper
from pandas.formats.format import set_eng_float_format
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from pandas.compat import builtins
import numpy as np

from pandas.types.missing import isnull
from pandas.types.generic import ABCDataFrame, ABCSeries, ABCIndexClass
from pandas.types.common import is_object_dtype, is_list_like, is_scalar
from pandas.core.types.missing import isnull
from pandas.core.types.generic import ABCDataFrame, ABCSeries, ABCIndexClass
from pandas.core.types.common import is_object_dtype, is_list_like, is_scalar
from pandas.util.validators import validate_bool_kwarg

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

from pandas.types.cast import is_nested_object
from pandas.core.types.cast import is_nested_object
from pandas import Series
result = Series(results, index=keys, name=self.name)
if is_nested_object(result):
Expand Down
35 changes: 19 additions & 16 deletions pandas/core/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@
from pandas.compat import u, lzip
from pandas._libs import lib, algos as libalgos

from pandas.types.generic import ABCSeries, ABCIndexClass, ABCCategoricalIndex
from pandas.types.missing import isnull, notnull
from pandas.types.cast import (maybe_infer_to_datetimelike,
coerce_indexer_dtype)
from pandas.types.dtypes import CategoricalDtype
from pandas.types.common import (_ensure_int64,
_ensure_object,
_ensure_platform_int,
is_dtype_equal,
is_datetimelike,
is_categorical,
is_categorical_dtype,
is_integer_dtype, is_bool,
is_list_like, is_sequence,
is_scalar)
from pandas.core.types.generic import (
ABCSeries, ABCIndexClass, ABCCategoricalIndex)
from pandas.core.types.missing import isnull, notnull
from pandas.core.types.cast import (
maybe_infer_to_datetimelike,
coerce_indexer_dtype)
from pandas.core.types.dtypes import CategoricalDtype
from pandas.core.types.common import (
_ensure_int64,
_ensure_object,
_ensure_platform_int,
is_dtype_equal,
is_datetimelike,
is_categorical,
is_categorical_dtype,
is_integer_dtype, is_bool,
is_list_like, is_sequence,
is_scalar)
from pandas.core.common import is_null_slice

from pandas.core.algorithms import factorize, take_1d, unique1d
Expand Down Expand Up @@ -1215,7 +1218,7 @@ def value_counts(self, dropna=True):
"""
from numpy import bincount
from pandas.types.missing import isnull
from pandas.core.types.missing import isnull
from pandas.core.series import Series
from pandas.core.index import CategoricalIndex

Expand Down
14 changes: 7 additions & 7 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
from pandas import compat
from pandas.compat import long, zip, iteritems
from pandas.core.config import get_option
from pandas.types.generic import ABCSeries
from pandas.types.common import _NS_DTYPE
from pandas.types.inference import _iterable_not_string
from pandas.types.missing import isnull
from pandas.core.types.generic import ABCSeries
from pandas.core.types.common import _NS_DTYPE
from pandas.core.types.inference import _iterable_not_string
from pandas.core.types.missing import isnull
from pandas.api import types
from pandas.types import common
from pandas.core.types import common

# compat
from pandas.errors import ( # noqa
Expand Down Expand Up @@ -60,7 +60,7 @@ def wrapper(*args, **kwargs):
warnings.warn("pandas.core.common.{t} is deprecated. "
"These are not longer public API functions, "
"but can be imported from "
"pandas.types.common.{t} instead".format(t=t),
"pandas.core.types.common.{t} instead".format(t=t),
DeprecationWarning, stacklevel=3)
return getattr(common, t)(*args, **kwargs)
return wrapper
Expand All @@ -73,7 +73,7 @@ def wrapper(*args, **kwargs):
def array_equivalent(*args, **kwargs):
warnings.warn("'pandas.core.common.array_equivalent' is deprecated and "
"is no longer public API", DeprecationWarning, stacklevel=2)
from pandas.types import missing
from pandas.core.types import missing
return missing.array_equivalent(*args, **kwargs)


Expand Down
2 changes: 1 addition & 1 deletion pandas/core/config_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def mpl_style_cb(key):


def use_inf_as_null_cb(key):
from pandas.types.missing import _use_inf_as_null
from pandas.core.types.missing import _use_inf_as_null
_use_inf_as_null(key)


Expand Down
66 changes: 34 additions & 32 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,40 @@
import numpy as np
import numpy.ma as ma

from pandas.types.cast import (maybe_upcast, infer_dtype_from_scalar,
maybe_cast_to_datetime,
maybe_infer_to_datetimelike,
maybe_convert_platform,
maybe_downcast_to_dtype,
invalidate_string_dtypes,
coerce_to_dtypes,
maybe_upcast_putmask,
find_common_type)
from pandas.types.common import (is_categorical_dtype,
is_object_dtype,
is_extension_type,
is_datetimetz,
is_datetime64_any_dtype,
is_datetime64tz_dtype,
is_bool_dtype,
is_integer_dtype,
is_float_dtype,
is_integer,
is_scalar,
is_dtype_equal,
needs_i8_conversion,
_get_dtype_from_object,
_ensure_float,
_ensure_float64,
_ensure_int64,
_ensure_platform_int,
is_list_like,
is_iterator,
is_sequence,
is_named_tuple)
from pandas.types.missing import isnull, notnull
from pandas.core.types.cast import (
maybe_upcast, infer_dtype_from_scalar,
maybe_cast_to_datetime,
maybe_infer_to_datetimelike,
maybe_convert_platform,
maybe_downcast_to_dtype,
invalidate_string_dtypes,
coerce_to_dtypes,
maybe_upcast_putmask,
find_common_type)
from pandas.core.types.common import (
is_categorical_dtype,
is_object_dtype,
is_extension_type,
is_datetimetz,
is_datetime64_any_dtype,
is_datetime64tz_dtype,
is_bool_dtype,
is_integer_dtype,
is_float_dtype,
is_integer,
is_scalar,
is_dtype_equal,
needs_i8_conversion,
_get_dtype_from_object,
_ensure_float,
_ensure_float64,
_ensure_int64,
_ensure_platform_int,
is_list_like,
is_iterator,
is_sequence,
is_named_tuple)
from pandas.core.types.missing import isnull, notnull

from pandas.core.common import (_try_sort,
_default_index,
Expand Down
33 changes: 17 additions & 16 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@
import pandas as pd

from pandas._libs import tslib, lib
from pandas.types.common import (_coerce_to_dtype,
_ensure_int64,
needs_i8_conversion,
is_scalar,
is_integer, is_bool,
is_bool_dtype,
is_numeric_dtype,
is_datetime64_dtype,
is_timedelta64_dtype,
is_datetime64tz_dtype,
is_list_like,
is_dict_like,
is_re_compilable)
from pandas.types.cast import maybe_promote, maybe_upcast_putmask
from pandas.types.missing import isnull, notnull
from pandas.types.generic import ABCSeries, ABCPanel
from pandas.core.types.common import (
_coerce_to_dtype,
_ensure_int64,
needs_i8_conversion,
is_scalar,
is_integer, is_bool,
is_bool_dtype,
is_numeric_dtype,
is_datetime64_dtype,
is_timedelta64_dtype,
is_datetime64tz_dtype,
is_list_like,
is_dict_like,
is_re_compilable)
from pandas.core.types.cast import maybe_promote, maybe_upcast_putmask
from pandas.core.types.missing import isnull, notnull
from pandas.core.types.generic import ABCSeries, ABCPanel

from pandas.core.common import (_values_from_object,
_maybe_box_datetimelike,
Expand Down
43 changes: 22 additions & 21 deletions pandas/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,27 @@
from pandas.compat.numpy import function as nv, _np_version_under1p8
from pandas.compat import set_function_name

from pandas.types.common import (is_numeric_dtype,
is_timedelta64_dtype, is_datetime64_dtype,
is_categorical_dtype,
is_interval_dtype,
is_datetimelike,
is_datetime64_any_dtype,
is_bool, is_integer_dtype,
is_complex_dtype,
is_bool_dtype,
is_scalar,
is_list_like,
needs_i8_conversion,
_ensure_float64,
_ensure_platform_int,
_ensure_int64,
_ensure_object,
_ensure_categorical,
_ensure_float)
from pandas.types.cast import maybe_downcast_to_dtype
from pandas.types.missing import isnull, notnull, _maybe_fill
from pandas.core.types.common import (
is_numeric_dtype,
is_timedelta64_dtype, is_datetime64_dtype,
is_categorical_dtype,
is_interval_dtype,
is_datetimelike,
is_datetime64_any_dtype,
is_bool, is_integer_dtype,
is_complex_dtype,
is_bool_dtype,
is_scalar,
is_list_like,
needs_i8_conversion,
_ensure_float64,
_ensure_platform_int,
_ensure_int64,
_ensure_object,
_ensure_categorical,
_ensure_float)
from pandas.core.types.cast import maybe_downcast_to_dtype
from pandas.core.types.missing import isnull, notnull, _maybe_fill

from pandas.core.common import (_values_from_object, AbstractMethodError,
_default_index)
Expand Down Expand Up @@ -4079,7 +4080,7 @@ def _apply_to_column_groupbys(self, func):
def count(self):
""" Compute count of group, excluding missing values """
from functools import partial
from pandas.types.missing import _isnull_ndarraylike as isnull
from pandas.core.types.missing import _isnull_ndarraylike as isnull

data, _ = self._get_data_to_aggregate()
ids, _, ngroups = self.grouper.group_info
Expand Down
Loading

0 comments on commit 8044942

Please sign in to comment.