Skip to content

Commit 334e69c

Browse files
committed
Update is_list_like
1 parent 0f8234c commit 334e69c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/_libs/lib.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1045,10 +1045,10 @@ def is_list_like(obj: object, allow_sets: bool = True) -> bool:
10451045
cdef inline bint c_is_list_like(object obj, bint allow_sets) except -1:
10461046
return (
10471047
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))
1050-
# exclude zero-dimensional numpy arrays, effectively scalars
1051-
and not (util.is_array(obj) and obj.ndim == 0)
10521052
# exclude sets if allow_sets is False
10531053
and not (allow_sets is False and isinstance(obj, abc.Set))
10541054
)

0 commit comments

Comments
 (0)