Skip to content

Preserve None in Series unique #20893

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 6 commits into from
May 11, 2018
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
5 changes: 5 additions & 0 deletions pandas/tests/series/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,11 @@ def test_unique(self):
tm.assert_categorical_equal(s.unique(), pd.Categorical([np.nan]),
check_dtype=False)

def test_unique_obj_na_preservation(self, nulls_fixture):
# GH 20866
s = pd.Series(['foo', nulls_fixture])
assert s.iloc[1] is nulls_fixture
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the .unique() is missing from s.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, that's a good reason that it is passing :-)

Copy link
Member Author

@WillAyd WillAyd May 1, 2018

Choose a reason for hiding this comment

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

Whoops...hmm well yes now I am getting nan just as you are so something strange is going on here. Going to bisect between d274d0b and b020891 as the behavior changed for me between those. Will post back results soon


@pytest.mark.parametrize(
"tc1, tc2",
[
Expand Down