Skip to content

Commit d90ce6c

Browse files
check for np.str_ when checking strings
1 parent 00a7c41 commit d90ce6c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/dtypes/inference.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def iterable_not_string(obj: object) -> bool:
100100
>>> iterable_not_string(1)
101101
False
102102
"""
103-
return isinstance(obj, abc.Iterable) and not isinstance(obj, str)
103+
return isinstance(obj, abc.Iterable) and not isinstance(obj, (str, np.str_))
104104

105105

106106
@set_module("pandas.api.types")
@@ -467,7 +467,7 @@ def is_sequence(obj: object) -> bool:
467467
iter(obj) # type: ignore[call-overload]
468468
# Has a length associated with it.
469469
len(obj) # type: ignore[arg-type]
470-
return not isinstance(obj, (str, bytes))
470+
return not isinstance(obj, (str, bytes, np.str_))
471471
except (TypeError, AttributeError):
472472
return False
473473

0 commit comments

Comments
 (0)