Skip to content

TST: Verify mask's return keeps dtype #50460

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
Jan 4, 2023

Conversation

luke396
Copy link
Contributor

@luke396 luke396 commented Dec 28, 2022

cond = ~ser.isna()
other = Series([True, False, True, False])
excepted = Series([1.0, 0.0, 1.0, 0.0], dtype=ser.dtype)
tm.assert_series_equal(ser.mask(cond, other), excepted)
Copy link
Member

Choose a reason for hiding this comment

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

Can you define result in one extra line? Makes it easier to read

Copy link
Contributor Author

Choose a reason for hiding this comment

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

like this?

result = ser.mask(cond, other)
tm.assert_series_equal(result, excepted)

Copy link
Member

Choose a reason for hiding this comment

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

Yep

@phofl phofl added the Indexing Related to indexing on series/frames, not to indexes themselves label Dec 28, 2022
@phofl phofl added this to the 2.0 milestone Dec 28, 2022
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
@phofl phofl merged commit c6d2f92 into pandas-dev:main Jan 4, 2023
@phofl
Copy link
Member

phofl commented Jan 4, 2023

thx @luke396

@luke396 luke396 deleted the test-mask-return-dtype branch January 4, 2023 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: TypeError when mixing extension array dtypes in mask
3 participants