We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0f8234c commit 334e69cCopy full SHA for 334e69c
pandas/_libs/lib.pyx
@@ -1045,10 +1045,10 @@ def is_list_like(obj: object, allow_sets: bool = True) -> bool:
1045
cdef inline bint c_is_list_like(object obj, bint allow_sets) except -1:
1046
return (
1047
isinstance(obj, abc.Iterable)
1048
+ # avoid numpy-style scalars
1049
+ and not (hasattr(obj, "ndim") and obj.ndim == 0)
1050
# we do not count strings/unicode/bytes as list-like
1051
and not isinstance(obj, (str, bytes))
- # exclude zero-dimensional numpy arrays, effectively scalars
- and not (util.is_array(obj) and obj.ndim == 0)
1052
# exclude sets if allow_sets is False
1053
and not (allow_sets is False and isinstance(obj, abc.Set))
1054
)
0 commit comments