Skip to content

CLN refactor core/arrays #37581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add parens, fix failing doctest
  • Loading branch information
MarcoGorelli committed Nov 4, 2020
commit a4c46e78415010a36da8d5acb0f56fbf62d93685
3 changes: 2 additions & 1 deletion pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ def __iter__(self):
# This needs to be implemented so that pandas recognizes extension
# arrays as list-like. The default implementation makes successive
# calls to ``__getitem__``, which may be slower than necessary.
yield from self
for i in range(len(self)):
yield self[i]

def __eq__(self, other: Any) -> ArrayLike:
"""
Expand Down
8 changes: 5 additions & 3 deletions pandas/core/arrays/boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ def coerce_to_array(
values[~mask_values] = values_object[~mask_values].astype(bool)

# if the values were integer-like, validate it were actually 0/1's
if inferred_dtype in integer_like and not np.all(
values[~mask_values].astype(float)
== values_object[~mask_values].astype(float)
if (inferred_dtype in integer_like) and not (
np.all(
values[~mask_values].astype(float)
== values_object[~mask_values].astype(float)
)
):
raise TypeError("Need to pass bool-like values")

Expand Down