diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index ab431b0faee16..7b4457fe477ca 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -581,58 +581,6 @@ def is_dtype_equal(source, target) -> bool: return False -def is_any_int_dtype(arr_or_dtype) -> bool: - """ - Check whether the provided array or dtype is of an integer dtype. - - 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. - - The nullable Integer dtypes (e.g. pandas.Int64Dtype) are also considered - as integer by this function. - - Parameters - ---------- - arr_or_dtype : array-like or dtype - The array or dtype to check. - - Returns - ------- - boolean - Whether or not the array or dtype is of an integer dtype. - - Examples - -------- - >>> is_any_int_dtype(str) - False - >>> is_any_int_dtype(int) - True - >>> is_any_int_dtype(float) - False - >>> is_any_int_dtype(np.uint64) - True - >>> is_any_int_dtype(np.datetime64) - False - >>> is_any_int_dtype(np.timedelta64) - True - >>> is_any_int_dtype(np.array(['a', 'b'])) - False - >>> is_any_int_dtype(pd.Series([1, 2])) - True - >>> is_any_int_dtype(np.array([], dtype=np.timedelta64)) - True - >>> is_any_int_dtype(pd.Index([1, 2.])) # float - False - """ - return _is_dtype_type( - arr_or_dtype, classes(np.integer, np.timedelta64) - ) or _is_dtype( - arr_or_dtype, lambda typ: isinstance(typ, ExtensionDtype) and typ.kind in "iu" - ) - - def is_integer_dtype(arr_or_dtype) -> bool: """ Check whether the provided array or dtype is of an integer dtype. @@ -936,10 +884,7 @@ def is_datetime64_ns_dtype(arr_or_dtype) -> bool: try: tipo = get_dtype(arr_or_dtype) except TypeError: - if is_datetime64tz_dtype(arr_or_dtype): - tipo = get_dtype(arr_or_dtype.dtype) - else: - return False + return False return tipo == DT64NS_DTYPE or ( isinstance(tipo, DatetimeTZDtype) and tipo.unit == "ns" ) @@ -1718,7 +1663,6 @@ def is_all_strings(value: ArrayLike) -> bool: "is_1d_only_ea_dtype", "is_1d_only_ea_obj", "is_all_strings", - "is_any_int_dtype", "is_any_real_numeric_dtype", "is_array_like", "is_bool", diff --git a/pandas/tests/extension/test_arrow.py b/pandas/tests/extension/test_arrow.py index 99f2a7d820dcb..12975499a8d5c 100644 --- a/pandas/tests/extension/test_arrow.py +++ b/pandas/tests/extension/test_arrow.py @@ -39,7 +39,6 @@ ) from pandas.errors import PerformanceWarning -from pandas.core.dtypes.common import is_any_int_dtype from pandas.core.dtypes.dtypes import CategoricalDtypeType import pandas as pd @@ -1584,15 +1583,6 @@ def test_is_integer_dtype(data): assert not is_integer_dtype(data) -def test_is_any_integer_dtype(data): - # GH 50667 - pa_type = data.dtype.pyarrow_dtype - if pa.types.is_integer(pa_type): - assert is_any_int_dtype(data) - else: - assert not is_any_int_dtype(data) - - def test_is_signed_integer_dtype(data): pa_type = data.dtype.pyarrow_dtype if pa.types.is_signed_integer(pa_type):