Skip to content

Add unique_counts()? #291

Closed
Closed

Description

@leofang

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)
   """

Activity

  1. added this to the v2022 milestone on Oct 23, 2021
  2. leofang commented on Oct 24, 2021

    @leofang
    ContributorAuthor

    Can we target this for v2021?

  3. kgryte commented on Oct 24, 2021

    @kgryte
    Contributor

    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.

  4. leofang commented on Oct 24, 2021

    @leofang
    ContributorAuthor

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

  5. self-assigned this
    on Nov 4, 2021
  6. modified the milestones: v2022, v2021 on Nov 4, 2021
  7. leofang commented on Nov 4, 2021

    @leofang
    ContributorAuthor

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

  8. kgryte commented on Nov 4, 2021

    @kgryte
    Contributor

    Thanks @leofang!

  9. rgommers commented on Nov 4, 2021

    @rgommers
    Member

    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 hav