Skip to content

Commit 337d40e

Browse files
authored
DOC: Improve api.types.is_dtype_equal docstring (#61394)
1 parent e55d907 commit 337d40e

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

doc/source/reference/arrays.rst

+1
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ Data type introspection
664664
api.types.is_datetime64_dtype
665665
api.types.is_datetime64_ns_dtype
666666
api.types.is_datetime64tz_dtype
667+
api.types.is_dtype_equal
667668
api.types.is_extension_array_dtype
668669
api.types.is_float_dtype
669670
api.types.is_int64_dtype

pandas/core/dtypes/common.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -655,24 +655,38 @@ def is_dtype_equal(source, target) -> bool:
655655
656656
Parameters
657657
----------
658-
source : The first dtype to compare
659-
target : The second dtype to compare
658+
source : type or str
659+
The first dtype to compare.
660+
target : type or str
661+
The second dtype to compare.
660662
661663
Returns
662664
-------
663665
boolean
664666
Whether or not the two dtypes are equal.
665667
668+
See Also
669+
--------
670+
api.types.is_categorical_dtype : Check whether the provided array or dtype
671+
is of the Categorical dtype.
672+
api.types.is_string_dtype : Check whether the provided array or dtype
673+
is of the string dtype.
674+
api.types.is_object_dtype : Check whether an array-like or dtype is of the
675+
object dtype.
676+
666677
Examples
667678
--------
679+
>>> from pandas.api.types import is_dtype_equal
668680
>>> is_dtype_equal(int, float)
669681
False
670682
>>> is_dtype_equal("int", int)
671683
True
672684
>>> is_dtype_equal(object, "category")
673685
False
686+
>>> from pandas.core.dtypes.dtypes import CategoricalDtype
674687
>>> is_dtype_equal(CategoricalDtype(), "category")
675688
True
689+
>>> from pandas.core.dtypes.dtypes import DatetimeTZDtype
676690
>>> is_dtype_equal(DatetimeTZDtype(tz="UTC"), "datetime64")
677691
False
678692
"""

0 commit comments

Comments
 (0)