Answers for "unique value count in np array"

5

count unique values numpy

number_list = numpy.array([1, 1, 2, 3, 4, 4, 1])
(unique, counts) = numpy.unique(number_list, return_counts=True)
Posted by: Guest on June-20-2021

Python Answers by Framework

Browse Popular Code Answers by Language