# Histograms

In this lesson, learn how to visualize and interpret a dataset using a histogram.

Start## Key Concepts

Review core concepts you need to learn to master this subject

Matplotlib Function To Create Histogram

Mean of a Dataset

Histogram Bins

What is a Histogram?

Histogram Bin Count

Histogram’s X and Y Axis

Matplotlib Function To Create Histogram

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

- 1Statistics 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…
- 2The 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 …
- 4In 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 …
- 5A
*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… - 6While 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…
- 7At 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…
- 8The 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…

## 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