#!/usr/bin/env python3 import numpy as np a = np.array([2, 2, 5, 8, 9, 9]) histogram = np.histogram(a,bins=[1,5,6,10]) print(histogram) # (array([2, 1, 3]), array([ 1, 5, 6, 10]))