Numpy provides us the feature to compute the Histogram for the given data set using NumPy.histogram() function. The formation of histogram depends on the data set, whether it is predefined or randomly generated.
Syntax : numpy.histogram(data, bins=10, range=None, normed=None, weights=None, density=None)
Case 1: Computing the Numpy Histogram with the help of Random Data set
In the above example, we created a random data set using np.random.randint() and plot the Numpy Histogram
Case 2: Computing the Numpy Histogram with the help of Pre-defined Data set
In the above example, we take a predefined data set and plot the Numpy Histogram.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.