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

TST: Add regression test for NaN sparse columns #52772

Merged
merged 2 commits into from
Apr 19, 2023

Conversation

ConnorMcKinley
Copy link
Contributor

@ConnorMcKinley ConnorMcKinley commented Apr 19, 2023

# GH 27781
df1 = pd.DataFrame({"A": SparseArray([0, 0, 0]), "B": [1, 2, 3]})
df2 = pd.DataFrame({"A": SparseArray([0, 1, 0]), "B": [1, 2, 3]})
result = df1.loc[df1["B"] != 2]
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 also compare this to a manually created dataframe i.e.

expected = pd.DataFrame({...})
tm.assert_frame_equal(result, expected)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added it, thanks for the suggestion.

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Apr 19, 2023
@mroeschke mroeschke added this to the 2.1 milestone Apr 19, 2023
@mroeschke mroeschke merged commit e96054a into pandas-dev:main Apr 19, 2023
@mroeschke
Copy link
Member

Thanks @ConnorMcKinley

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filtering dataframe with sparse column leads to NAs in sparse column
2 participants