Skip to content

TST: GH 32431 check print label indexing on nan #36635

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 5 commits into from
Nov 18, 2020
Merged
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
7 changes: 7 additions & 0 deletions pandas/tests/indexing/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,13 @@ def test_no_reference_cycle(self):
del df
assert wr() is None

def test_label_indexing_on_nan(self):
# GH 32431
df = pd.Series([1, "{1,2}", 1, None])
vc = df.value_counts(dropna=False)
print(vc.loc[np.nan])
Copy link
Member

Choose a reason for hiding this comment

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

Rather than just printing you should construct the expected result and use tm.assert_series_equal(result, expected) - you should see this idiom throughout the test modules if you need a reference

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback! I constructed the expected result and expected an int. So I compared the results just with a normal assert, since I couldn't find a method on tm to assert ints. Please let me know if this satisfies your request

print(vc[np.nan])


class TestSeriesNoneCoercion:
EXPECTED_RESULTS = [
Expand Down