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

Add is_unique for Index & MultiIndex #1766

Merged
merged 3 commits into from
Sep 14, 2020

Conversation

itholic
Copy link
Contributor

@itholic itholic commented Sep 11, 2020

This PR proposes is_unique for Index & MultiIndex.

Basically it's opposite to has_duplicates

>>> idx = ks.Index([1, 5, 7, 7])
>>> idx.is_unique
False

>>> idx = ks.Index([1, 5, 7])
>>> idx.is_unique
True

>>> idx = ks.Index(["Watermelon", "Orange", "Apple",
...                 "Watermelon"])
>>> idx.is_unique
False

>>> idx = ks.Index(["Orange", "Apple",
...                 "Watermelon"])
>>> idx.is_unique
True

And fixed some tests to sync with pandas'.

Copy link
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

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

Looks good otherwise.

@HyukjinKwon HyukjinKwon merged commit c62f83c into databricks:master Sep 14, 2020
@itholic itholic deleted the i_is_unique branch October 6, 2020 00:17
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.

2 participants