Skip to content

Commit 380b410

Browse files
committed
Improve fix
1 parent c3d6fc4 commit 380b410

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pandas/core/dtypes/cast.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,10 +1926,9 @@ def np_can_hold_element(dtype: np.dtype, element: Any) -> Any:
19261926
# i.e. there are pd.NA elements
19271927
raise LossySetitemError
19281928
return element
1929-
# GH 57338
1930-
# Check boolean array set as object type
1929+
# GH 57338 check boolean array set as object type
19311930
if tipo.kind == "O" and isinstance(element, np.ndarray):
1932-
if all(lib.is_bool(e) for e in element):
1931+
if lib.is_bool_array(element):
19331932
return element.astype("bool")
19341933
raise LossySetitemError
19351934

0 commit comments

Comments
 (0)