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 Index unique #912

Merged
merged 12 commits into from
Oct 22, 2019
Merged

Conversation

charlesdong1991
Copy link
Contributor

#880

ks.DataFrame({'a': ['a', 'b', 'c']}, index=[1, 1, 3]).index.unique()
Int64Index([1, 3], dtype='int64')

@charlesdong1991
Copy link
Contributor Author

emm, any idea how to fix missing function failure? @ueshin the error message doesn't seem very intuitive.

@ueshin
Copy link
Collaborator

ueshin commented Oct 10, 2019

@charlesdong1991 Thanks for working on this!
You also need to remove the line from _MissingPandasLikeMultiIndex.

@charlesdong1991
Copy link
Contributor Author

ahh, thanks for your quick reply! @ueshin

@codecov-io
Copy link

codecov-io commented Oct 10, 2019

Codecov Report

Merging #912 into master will decrease coverage by 0.09%.
The diff coverage is 86.66%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #912     +/-   ##
=========================================
- Coverage   94.47%   94.37%   -0.1%     
=========================================
  Files          34       34             
  Lines        6392     6405     +13     
=========================================
+ Hits         6039     6045      +6     
- Misses        353      360      +7
Impacted Files Coverage Δ
databricks/koalas/missing/indexes.py 100% <ø> (ø) ⬆️
databricks/koalas/indexes.py 96.42% <86.66%> (-0.96%) ⬇️
databricks/koalas/__init__.py 82.92% <0%> (-2.44%) ⬇️
databricks/conftest.py 95.74% <0%> (-2.13%) ⬇️
databricks/koalas/generic.py 95.07% <0%> (-0.5%) ⬇️
databricks/koalas/groupby.py 91.18% <0%> (-0.21%) ⬇️
databricks/koalas/frame.py 95.96% <0%> (-0.07%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 580f48c...17c709e. Read the comment docs.

@@ -140,6 +140,21 @@ def test_multi_index_names(self):
with self.assertRaises(PandasNotImplementedError):
kidx.name = 'renamed'

def test_index_unique(self):
Copy link
Member

Choose a reason for hiding this comment

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

Sorry if I missed but did we have a test case for multi-index?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, i think their implementation is slightly different, and i thought the scope of this PR is for Index, not MultiIndex (I was supposed to do in a separate PR).

But do you prefer to have this unique function added for both Index and MultiIndex in this PR? @HyukjinKwon

Copy link
Member

Choose a reason for hiding this comment

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

Ah, it's fine to target to implement it only in Index. Can we explicitly throw a notimplemented exception manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i added a PandasNotImplementedError, pls let me know if this is what you meant, thanks.

@charlesdong1991
Copy link
Contributor Author

any follow up review will be appreciated! :)

@@ -104,7 +104,6 @@ class _MissingPandasLikeIndex(object):
to_numpy = unsupported_function('to_numpy')
transpose = unsupported_function('transpose')
union = unsupported_function('union')
unique = unsupported_function('unique')
value_counts = unsupported_function('value_counts')
view = unsupported_function('view')
where = unsupported_function('where')
Copy link
Member

Choose a reason for hiding this comment

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

@charlesdong1991, sorry can you remove unique at _MissingPandasLikeMultiIndex as well?

Techinically MultiIndex has the method called unique. It's a bit complicated because MultiIndex inherits Index, so I suggested to throw an exception :-)..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, removed! @HyukjinKwon

i will get some free time recently, and see if I could add some properties and functions for Index and MultiIndex and then implement unique for MultiIndex if itholic hasn't implemented them all beforehand xD 😝

Copy link
Member

Choose a reason for hiding this comment

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

That would be awesome!!

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.

LGTM otherwise

@HyukjinKwon
Copy link
Member

LGTM. I will merge once the conflicts are resolved.

@softagram-bot
Copy link

Softagram Impact Report for pull/912 (head commit: 17c709e)

⭐ Change Overview

Showing the changed files, dependency changes and the impact - click for full size
(Open in Softagram Desktop for full details)

📄 Full report

Impact Report explained. Give feedback on this report to [email protected]

@charlesdong1991
Copy link
Contributor Author

oops, should have merged to master before pushing commits.

@HyukjinKwon HyukjinKwon merged commit 345c7da into databricks:master Oct 22, 2019
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.

5 participants