Skip to content
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

fix: cast bool_ to int8 for positional reducers #2935

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

agoose77
Copy link
Collaborator

Fixes #2934

Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5d16503) 81.95% compared to head (e5ea29c) 81.95%.

Additional details and impacted files
Files Coverage Δ
src/awkward/_reducers.py 97.31% <100.00%> (+0.12%) ⬆️

Copy link
Collaborator

@ianna ianna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agoose77 - thanks, it looks great!

from Python documentation: "bool is a subclass of int (see Numeric Types — int, float, complex). In many numeric contexts, False and True behave like the integers 0 and 1, respectively. However, relying on this is discouraged; explicitly convert using int() instead."
Viewing a bool as an int8 is correct!

src/awkward/_reducers.py Show resolved Hide resolved
@agoose77 agoose77 merged commit 6a0b318 into main Jan 11, 2024
38 checks passed
@agoose77 agoose77 deleted the agoose77/fix-argminmax-bool branch January 11, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ak.argmax and ak.argmin: support for Boolean arrays
2 participants