Skip to content

Instantly share code, notes, and snippets.

@elowy01
Last active July 26, 2022 15:07
Show Gist options
  • Save elowy01/c371ad36c68f088e1efa9e9b6aae94c4 to your computer and use it in GitHub Desktop.
Save elowy01/c371ad36c68f088e1efa9e9b6aae94c4 to your computer and use it in GitHub Desktop.
# Bins numerical data and returns the different counts for each category
mport numpy as np
a = np.array([22,87,5,43,56,73,55,54,11,20,51,5,79,31,27])
hist,bins = np.histogram(a,bins = [0,20,40,60,80,100])
print(hist) # [3 4 5 2 1]
print(bins) # [ 0 20 40 60 80 100]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment