File tree 2 files changed +20
-2
lines changed
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import numpy as np
4
4
5
+ import pandas as pd
5
6
from pandas import DataFrame
6
7
import pandas ._testing as tm
7
- from pandas .api .types import pandas_dtype
8
+ from pandas .api .types import is_extension_array_dtype , pandas_dtype
8
9
9
10
from .pandas_vb_common import (
10
11
datetime_dtypes ,
@@ -119,4 +120,16 @@ def time_select_dtype_string_exclude(self, dtype):
119
120
self .df_string .select_dtypes (exclude = dtype )
120
121
121
122
123
+ class CheckDtypes :
124
+ def setup (self ):
125
+ self .ext_dtype = pd .Int64Dtype ()
126
+ self .np_dtype = np .dtype ("int64" )
127
+
128
+ def time_is_extension_array_dtype_true (self ):
129
+ is_extension_array_dtype (self .ext_dtype )
130
+
131
+ def time_is_extension_array_dtype_false (self ):
132
+ is_extension_array_dtype (self .np_dtype )
133
+
134
+
122
135
from .pandas_vb_common import setup # noqa: F401 isort:skip
Original file line number Diff line number Diff line change @@ -1526,7 +1526,12 @@ def is_extension_array_dtype(arr_or_dtype) -> bool:
1526
1526
False
1527
1527
"""
1528
1528
dtype = getattr (arr_or_dtype , "dtype" , arr_or_dtype )
1529
- return isinstance (dtype , ExtensionDtype ) or registry .find (dtype ) is not None
1529
+ if isinstance (dtype , ExtensionDtype ):
1530
+ return True
1531
+ elif isinstance (dtype , np .dtype ):
1532
+ return False
1533
+ else :
1534
+ return registry .find (dtype ) is not None
1530
1535
1531
1536
1532
1537
def is_ea_or_datetimelike_dtype (dtype : Optional [DtypeObj ]) -> bool :
You can’t perform that action at this time.
0 commit comments