## Key Concepts

Review core concepts you need to learn to master this subject

### Matplotlib Function To Create Histogram

``````import numpy as np
from matplotlib import pyplot as plt

# numpy array
data_array = np.array([1,1,1,1,1,2,3,3,3,4,4,5,5,6,7])

# plot histogram
plt.hist(data_array, range = (1,7), bins = 7)``````

In Python, the `pyplot.hist()` function in the Matplotlib pyplot library can be used to plot a histogram. The function accepts a NumPy array, the range of the dataset, and the number of bins as input.

Histograms
Lesson 1 of 1
1. 1
Statistics is often pitched as a way to find certainty through data. As you’ll learn in this lesson, the power of statistics is more often used to communicate that certainty doesn’t really exist. I…
2. 2
The purpose of a histogram is to summarize data that you can use to inform a decision or explain a distribution. While a histogram is one of the most useful tools for communicating trends, people …
3. 3
Histograms are helpful for understanding how your data is distributed. While the average time a customer may arrive at the grocery store is 3 pm, the manager knows 3 pm is not the busiest time of d…
4. 4
In the previous exercise, you found that the earliest transaction time is close to 0, and the latest transaction is close to 24, making your range nearly 24 hours. Now, we have the information we …
5. 5
A count is the number of values that fall within a bin’s range. For example, if 100 customers arrive at your grocery store between midnight (0) and 6 am (6), your count for that bin is equal to 1…
6. 6
While counting the number of values in a bin is straightforward, it is also time-consuming. How long do you think it would take you to count the number of values in each bin for: - an exercise clas…
7. 7
At this point, you’ve learned how to find the numerical inputs to a histogram. Thus far the size of our datasets and bins have produced results that we can interpret. This becomes increasingly diff…
8. 8
The figure below displays the graph that you created in the last exercise: This histogram is helpful for our store manager. The last six hours of the day are the busiest — from 6 pm until…
9. 9
In this lesson, you learned what a histogram is, how to calculate it using NumPy, and how to plot one with Matplotlib. The example that we used throughout this lesson, finding the busiest times of…

## What you'll create

Portfolio projects that showcase your new skills ## How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory 