Skip to content

Commit 764e7b1

Browse files
committed
Revert to relying on python's shortcircuit operators
Also avoid np.iterable
1 parent d9a2c8f commit 764e7b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/_libs/lib.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,9 @@ def is_list_like(obj: object, allow_sets: bool = True) -> bool:
10441044

10451045
cdef inline bint c_is_list_like(object obj, bint allow_sets) except -1:
10461046
return (
1047-
np.iterable(obj)
1047+
isinstance(obj, abc.Iterable)
1048+
# avoid numpy-style scalars
1049+
and not (hasattr(obj, "ndim") and obj.ndim == 0)
10481050
# we do not count strings/unicode/bytes as list-like
10491051
and not isinstance(obj, (str, bytes))
10501052
# exclude sets if allow_sets is False

0 commit comments

Comments
 (0)