File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 15
15
Interval ,
16
16
Period ,
17
17
algos ,
18
+ lib ,
18
19
)
19
20
from pandas ._libs .tslibs import conversion
20
21
from pandas ._typing import (
@@ -558,8 +559,12 @@ def is_string_dtype(arr_or_dtype) -> bool:
558
559
>>> is_string_dtype(pd.Series([1, 2]))
559
560
False
560
561
"""
561
- # TODO: gh-15585: consider making the checks stricter.
562
+
562
563
def condition (dtype ) -> bool :
564
+ if isinstance (arr_or_dtype , np .ndarray ):
565
+ if not lib .infer_dtype (arr_or_dtype ) in ("string" , "unicode" ):
566
+ return False
567
+
563
568
return dtype .kind in ("O" , "S" , "U" ) and not is_excluded_dtype (dtype )
564
569
565
570
def is_excluded_dtype (dtype ) -> bool :
@@ -1316,7 +1321,6 @@ def is_bool_dtype(arr_or_dtype) -> bool:
1316
1321
# now we use the special definition for Index
1317
1322
1318
1323
if isinstance (arr_or_dtype , ABCIndex ):
1319
-
1320
1324
# TODO(jreback)
1321
1325
# we don't have a boolean Index class
1322
1326
# so its object, we need to infer to
@@ -1666,7 +1670,6 @@ def infer_dtype_from_object(dtype) -> DtypeObj:
1666
1670
if is_extension_array_dtype (dtype ):
1667
1671
return dtype .type
1668
1672
elif isinstance (dtype , str ):
1669
-
1670
1673
# TODO(jreback)
1671
1674
# should deprecate these
1672
1675
if dtype in ["datetimetz" , "datetime64tz" ]:
You can’t perform that action at this time.
0 commit comments