Last active
December 12, 2019 03:56
-
-
Save miracleyoo/53c1e03cd53dbdfebe53b945f08fc925 to your computer and use it in GitHub Desktop.
[count numpy array] #python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections, numpy | |
a = numpy.array([0, 3, 0, 1, 0, 1, 2, 1, 0, 0, 0, 0, 1, 3, 4]) | |
collections.Counter(a) | |
# [Out]: Counter({0: 7, 1: 4, 3: 2, 2: 1, 4: 1}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment