From a6c1864cdab9ce6eec3882c93be269bc0997fe0f Mon Sep 17 00:00:00 2001 From: gfyoung Date: Sun, 28 Oct 2018 06:41:17 -0700 Subject: [PATCH] CLN: Remove some dtype methods from API (#23390) Removes the following from the public API: * pandas.api.types.is_sequence * pandas.api.types.is_any_int_dtype * pandas.api.types.is_floating_dtype xref gh-16163. xref gh-16189. --- doc/source/whatsnew/v0.24.0.txt | 1 + pandas/core/dtypes/api.py | 23 ----------------------- pandas/core/dtypes/common.py | 6 ++++-- pandas/tests/api/test_types.py | 2 +- 4 files changed, 6 insertions(+), 26 deletions(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 9ebcaeed32240f..3e568fde0a616d 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -956,6 +956,7 @@ Removal of prior version deprecations/changes - :meth:`DataFrame.sortlevel` and :meth:`Series.sortlevel` have been removed (:issue:`15099`) - :meth:`SparseSeries.to_dense` has dropped the ``sparse_only`` parameter (:issue:`14686`) - :meth:`DataFrame.astype` and :meth:`Series.astype` have renamed the ``raise_on_error`` argument to ``errors`` (:issue:`14967`) +- ``is_sequence``, ``is_any_int_dtype``, and ``is_floating_dtype`` have been removed from ``pandas.api.types`` (:issue:`16163`, :issue:`16189`) .. _whatsnew_0240.performance: diff --git a/pandas/core/dtypes/api.py b/pandas/core/dtypes/api.py index 738e1ea9062f6a..7bf3912b05b1d5 100644 --- a/pandas/core/dtypes/api.py +++ b/pandas/core/dtypes/api.py @@ -1,7 +1,5 @@ # flake8: noqa -import sys - from .common import (pandas_dtype, is_dtype_equal, is_extension_type, @@ -59,24 +57,3 @@ is_list_like, is_hashable, is_named_tuple) - - -# deprecated -m = sys.modules['pandas.core.dtypes.api'] - -for t in ['is_any_int_dtype', 'is_floating_dtype', 'is_sequence']: - - def outer(t=t): - - def wrapper(arr_or_dtype): - import warnings - import pandas - warnings.warn("{t} is deprecated and will be " - "removed in a future version".format(t=t), - FutureWarning, stacklevel=3) - return getattr(pandas.core.dtypes.common, t)(arr_or_dtype) - return wrapper - - setattr(m, t, outer(t)) - -del sys, m, t, outer diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index da26c2ef74b41d..938392ebfc96df 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -796,11 +796,11 @@ def is_dtype_union_equal(source, target): def is_any_int_dtype(arr_or_dtype): """Check whether the provided array or dtype is of an integer dtype. - .. deprecated:: 0.20.0 - In this function, timedelta64 instances are also considered "any-integer" type objects and will return True. + This function is internal and should not be exposed in the public API. + Parameters ---------- arr_or_dtype : array-like @@ -1560,6 +1560,8 @@ def is_float_dtype(arr_or_dtype): """ Check whether the provided array or dtype is of a float dtype. + This function is internal and should not be exposed in the public API. + Parameters ---------- arr_or_dtype : array-like diff --git a/pandas/tests/api/test_types.py b/pandas/tests/api/test_types.py index 4ea501dacddf38..c36af4404e646b 100644 --- a/pandas/tests/api/test_types.py +++ b/pandas/tests/api/test_types.py @@ -27,7 +27,7 @@ class TestTypes(Base): 'is_list_like', 'is_hashable', 'is_array_like', 'is_named_tuple', 'pandas_dtype', 'union_categoricals', 'infer_dtype'] - deprecated = ['is_any_int_dtype', 'is_floating_dtype', 'is_sequence'] + deprecated = [] dtypes = ['CategoricalDtype', 'DatetimeTZDtype', 'PeriodDtype', 'IntervalDtype']