Skip to content

Commit d918ed3

Browse files
authored
CLN: remove unused is_any_int_dtype (#52562)
1 parent 4df76ef commit d918ed3

File tree

2 files changed

+1
-67
lines changed

2 files changed

+1
-67
lines changed

pandas/core/dtypes/common.py

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -581,58 +581,6 @@ def is_dtype_equal(source, target) -> bool:
581581
return False
582582

583583

584-
def is_any_int_dtype(arr_or_dtype) -> bool:
585-
"""
586-
Check whether the provided array or dtype is of an integer dtype.
587-
588-
In this function, timedelta64 instances are also considered "any-integer"
589-
type objects and will return True.
590-
591-
This function is internal and should not be exposed in the public API.
592-
593-
The nullable Integer dtypes (e.g. pandas.Int64Dtype) are also considered
594-
as integer by this function.
595-
596-
Parameters
597-
----------
598-
arr_or_dtype : array-like or dtype
599-
The array or dtype to check.
600-
601-
Returns
602-
-------
603-
boolean
604-
Whether or not the array or dtype is of an integer dtype.
605-
606-
Examples
607-
--------
608-
>>> is_any_int_dtype(str)
609-
False
610-
>>> is_any_int_dtype(int)
611-
True
612-
>>> is_any_int_dtype(float)
613-
False
614-
>>> is_any_int_dtype(np.uint64)
615-
True
616-
>>> is_any_int_dtype(np.datetime64)
617-
False
618-
>>> is_any_int_dtype(np.timedelta64)
619-
True
620-
>>> is_any_int_dtype(np.array(['a', 'b']))
621-
False
622-
>>> is_any_int_dtype(pd.Series([1, 2]))
623-
True
624-
>>> is_any_int_dtype(np.array([], dtype=np.timedelta64))
625-
True
626-
>>> is_any_int_dtype(pd.Index([1, 2.])) # float
627-
False
628-
"""
629-
return _is_dtype_type(
630-
arr_or_dtype, classes(np.integer, np.timedelta64)
631-
) or _is_dtype(
632-
arr_or_dtype, lambda typ: isinstance(typ, ExtensionDtype) and typ.kind in "iu"
633-
)
634-
635-
636584
def is_integer_dtype(arr_or_dtype) -> bool:
637585
"""
638586
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:
936884
try:
937885
tipo = get_dtype(arr_or_dtype)
938886
except TypeError:
939-
if is_datetime64tz_dtype(arr_or_dtype):
940-
tipo = get_dtype(arr_or_dtype.dtype)
941-
else:
942-
return False
887+
return False
943888
return tipo == DT64NS_DTYPE or (
944889
isinstance(tipo, DatetimeTZDtype) and tipo.unit == "ns"
945890
)
@@ -1718,7 +1663,6 @@ def is_all_strings(value: ArrayLike) -> bool:
17181663
"is_1d_only_ea_dtype",
17191664
"is_1d_only_ea_obj",
17201665
"is_all_strings",
1721-
"is_any_int_dtype",
17221666
"is_any_real_numeric_dtype",
17231667
"is_array_like",
17241668
"is_bool",

pandas/tests/extension/test_arrow.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
)
4040
from pandas.errors import PerformanceWarning
4141

42-
from pandas.core.dtypes.common import is_any_int_dtype
4342
from pandas.core.dtypes.dtypes import CategoricalDtypeType
4443

4544
import pandas as pd
@@ -1584,15 +1583,6 @@ def test_is_integer_dtype(data):
15841583
assert not is_integer_dtype(data)
15851584

15861585

1587-
def test_is_any_integer_dtype(data):
1588-
# GH 50667
1589-
pa_type = data.dtype.pyarrow_dtype
1590-
if pa.types.is_integer(pa_type):
1591-
assert is_any_int_dtype(data)
1592-
else:
1593-
assert not is_any_int_dtype(data)
1594-
1595-
15961586
def test_is_signed_integer_dtype(data):
15971587
pa_type = data.dtype.pyarrow_dtype
15981588
if pa.types.is_signed_integer(pa_type):

0 commit comments

Comments
 (0)