pandas and NumPy 3 · NumPy

Find distinct values

Get the sorted unique values and how often each occurs.

values, counts = np.unique(a, return_counts=True)

Official pandas and NumPy 3 documentation

More numpy commands

All numpy commands · pandas and NumPy 3 cheatsheet

Was this page helpful?