Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/reference/arrays.rst
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ Data type introspection
api.types.is_datetime64_dtype
api.types.is_datetime64_ns_dtype
api.types.is_datetime64tz_dtype
api.types.is_dtype_equal
api.types.is_extension_array_dtype
api.types.is_float_dtype
api.types.is_int64_dtype
Expand Down
18 changes: 16 additions & 2 deletions pandas/core/dtypes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,24 +655,38 @@ def is_dtype_equal(source, target) -> bool:

Parameters
----------
source : The first dtype to compare
target : The second dtype to compare
source : dtype
The first dtype to compare
target : dtype
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in 7ca7023.

The second dtype to compare

Returns
-------
boolean
Whether or not the two dtypes are equal.

See Also
--------
pandas.api.types.is_categorical_dtype : Check whether the provided array or dtype
is of the Categorical dtype.
pandas.api.types.is_string_dtype : Check whether the provided array or dtype
is of the string dtype.
pandas.api.types.is_object_dtype : Check whether an array-like or dtype is of the
object dtype.

Examples
--------
>>> from pandas.api.types import is_dtype_equal
>>> is_dtype_equal(int, float)
False
>>> is_dtype_equal("int", int)
True
>>> is_dtype_equal(object, "category")
False
>>> from pandas.core.dtypes.dtypes import CategoricalDtype
>>> is_dtype_equal(CategoricalDtype(), "category")
True
>>> from pandas.core.dtypes.dtypes import DatetimeTZDtype
>>> is_dtype_equal(DatetimeTZDtype(tz="UTC"), "datetime64")
False
"""
Expand Down
Loading