Base.countUniqueElements

Base.countUniqueElements(points=None, features=None)

Count of each unique value in the data.

Parameters:
  • points (identifier, list of identifiers) – May be None indicating application to all points, a single name or index or an iterable of points and/or indices.

  • features (identifier, list of identifiers) – May be None indicating application to all features, a single name or index or an iterable of names and/or indices.

Returns:

dict – Each unique value as keys and the number of times that value occurs as values.

Examples

Count for all elements.

>>> X = nimble.identity(5)
>>> unique = X.countUniqueElements()
>>> unique
{0: 20, 1: 5}

Count for a subset of elements.

>>> X = nimble.identity(5)
>>> unique = X.countUniqueElements(points=0,
...                                   features=[0, 1, 2])
>>> unique
{0: 2, 1: 1}

Keywords: counts, tally, distinct, different, different