Making a histogram

Introduction to Data Science in Python

Hillary Green-Lerman

Lead Data Scientist, Looker

Tracking down the kidnapper

Introduction to Data Science in Python

What is a histogram?

Introduction to Data Science in Python

Histograms with matplotlib

plt.hist(gravel.mass)

plt.show()

Introduction to Data Science in Python

Changing bins

plt.hist(data, bins=nbins)
plt.hist(gravel.mass, bins=40)

Introduction to Data Science in Python

Changing range

plt.hist(data,
         range=(xmin, xmax))
plt.hist(gravel.mass,
         range=(50, 100))

Introduction to Data Science in Python

Normalizing

Unnormalized bar plot

plt.hist(male_weight)
plt.hist(female_weight)

Sum of bar area = 1

plt.hist(male_weight, density=True)
plt.hist(female_weight, density=True)

Introduction to Data Science in Python

Let's practice!

Introduction to Data Science in Python

Preparing Video For Download...