Skip to content

Commit f527f3c

Browse files
committed
Revert to relying on python's shortcircuit operators
Also avoid np.iterable
1 parent 41ef807 commit f527f3c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/_libs/lib.pyx

+3-1
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,9 @@ def is_list_like(obj: object, allow_sets: bool = True) -> bool:
991991

992992
cdef inline bint c_is_list_like(object obj, bint allow_sets) except -1:
993993
return (
994-
np.iterable(obj)
994+
isinstance(obj, abc.Iterable)
995+
# avoid numpy-style scalars
996+
and not (hasattr(obj, "ndim") and obj.ndim == 0)
995997
# we do not count strings/unicode/bytes as list-like
996998
and not isinstance(obj, (str, bytes))
997999
# exclude sets if allow_sets is False

0 commit comments

Comments
 (0)