9951 explained code solutions for 126 technologies


python-numpyNumpy histogram example


import numpy as np
array = np.array([5,6,6])
histres = np.histogram(array, 2)ctrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

.histogram

calculates histogram for specified array and bins

2

this means we want to automatically create 3 bins for our histogram

histres

will contain calculated histogram