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 unique_counts()? #291

Closed
leofang opened this issue Oct 22, 2021 · 6 comments · Fixed by #317
Closed

Add unique_counts()? #291

leofang opened this issue Oct 22, 2021 · 6 comments · Fixed by #317
Assignees
Labels
API extension Adds new functions or objects to the API.
Milestone

Comments

@leofang
Copy link
Contributor

leofang commented Oct 22, 2021

This is a follow-up of #275. I've found numpy.unique(x, return_counts=True) quite useful. It allows us to build a histogram for the input array x. I'd suggest us to add the following function:

def unique_counts(x, /):
   """
   return a tuple of two arrays (unique values and counts)
   """
@kgryte kgryte added the API extension Adds new functions or objects to the API. label Oct 23, 2021
@kgryte kgryte added this to the v2022 milestone Oct 23, 2021
@leofang
Copy link
Contributor Author

leofang commented Oct 24, 2021

Can we target this for v2021?

@kgryte
Copy link
Contributor

kgryte commented Oct 24, 2021

We'd be cutting this quite close. :)

Quite close that is for getting support from other array libraries that this is something we want to add for the 2021 revision.

@leofang
Copy link
Contributor Author

leofang commented Oct 24, 2021

I see. I know NumPy/CuPy have no problem in supporting this, but I am not sure about others.

@leofang leofang self-assigned this Nov 4, 2021
@leofang leofang modified the milestones: v2022, v2021 Nov 4, 2021
@leofang
Copy link
Contributor Author

leofang commented Nov 4, 2021

I'll work on this as per the discussion in today's call.

@kgryte
Copy link
Contributor

kgryte commented Nov 4, 2021

Thanks @leofang!

@rgommers
Copy link
Member

rgommers commented Nov 4, 2021

Seems very reasonable, and if we add it we should indeed add it to the v2021 milestone. Better to do all four new unique_* functions in one go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API extension Adds new functions or objects to the API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants