Skip to content

Commit 59c3132

Browse files
jbrockmendeljreback
authored andcommitted
Fix zillion deprecation warnings in core.dtypes.common (#22142)
1 parent 20f7ae8 commit 59c3132

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/dtypes/common.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,9 @@ def pandas_dtype(dtype):
20162016
# also catch some valid dtypes such as object, np.object_ and 'object'
20172017
# which we safeguard against by catching them earlier and returning
20182018
# np.dtype(valid_dtype) before this condition is evaluated.
2019-
if dtype in [object, np.object_, 'object', 'O']:
2019+
if is_hashable(dtype) and dtype in [object, np.object_, 'object', 'O']:
2020+
# check hashability to avoid errors/DeprecationWarning when we get
2021+
# here and `dtype` is an array
20202022
return npdtype
20212023
elif npdtype.kind == 'O':
20222024
raise TypeError("dtype '{}' not understood".format(dtype))

0 commit comments

Comments
 (0)