We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f40d3d commit 2404f3dCopy full SHA for 2404f3d
pandas/core/dtypes/common.py
@@ -2,8 +2,8 @@
2
Common type operations.
3
"""
4
from __future__ import annotations
5
-import inspect
6
+import inspect
7
from typing import (
8
Any,
9
Callable,
@@ -31,7 +31,6 @@
31
DatetimeTZDtype,
32
ExtensionDtype,
33
IntervalDtype,
34
- PandasExtensionDtype,
35
PeriodDtype,
36
)
37
from pandas.core.dtypes.generic import (
@@ -1576,9 +1575,8 @@ def get_dtype(arr_or_dtype) -> DtypeObj:
1576
1575
# fastpath
1577
elif isinstance(arr_or_dtype, np.dtype):
1578
return arr_or_dtype
1579
- elif isinstance(arr_or_dtype, type):
+ elif inspect.isclass(arr_or_dtype) and issubclass(arr_or_dtype, np.generic):
1580
return np.dtype(arr_or_dtype)
1581
-
1582
# if we have an array-like
1583
elif hasattr(arr_or_dtype, "dtype"):
1584
arr_or_dtype = arr_or_dtype.dtype
0 commit comments