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

BUG: fix #59965 skipna=True operations don't skip NaN in FloatingArrays #59997

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

cooolheater
Copy link

@cooolheater cooolheater commented Oct 7, 2024

- Issue: The skipna was not properly handled for BaseMaskedArray
- Fix: Added mask for NA values
- Test: Added test to series/test_reductions since the test uses

…oatingArrays

    - Issue: The skipna was not properly handled for BaseMaskedArray
    - Fix: Added mask for NA values
    - Test: Added test to series/test_reductions since the test uses
@cooolheater cooolheater marked this pull request as draft October 9, 2024 05:18
@cooolheater cooolheater marked this pull request as ready for review October 9, 2024 05:19
pandas/core/array_algos/masked_reductions.py Outdated Show resolved Hide resolved
pandas/tests/series/test_reductions.py Outdated Show resolved Hide resolved
pandas/tests/series/test_reductions.py Outdated Show resolved Hide resolved
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

I think this looks good! Also will need a whatsnew note in the Numeric section of v3.0.0.rst.

series1 = Series({"a": 0.0, "b": 1, "c": 1}, dtype="Float64")
series2 = Series({"a": 0.0, "b": 2, "c": 2}, dtype="Float64")
result = series1 / series2
assert pd.notna(result.mean(skipna=True))
Copy link
Member

Choose a reason for hiding this comment

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

Nit: can you assert the value here (it is a slightly stronger test). Can use np.isclose.

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.

BUG: skipna=True operations don't skip NaN in FloatingArrays
2 participants