Histogram

Intermediate Python

Hugo Bowne-Anderson

Data Scientist at DataCamp

Histogram

  • Explore dataset
  • Get idea about distribution
Intermediate Python

Histogram

  • Explore dataset
  • Get idea about distribution

Intermediate Python

Histogram

  • Explore dataset
  • Get idea about distribution

Intermediate Python

Histogram

  • Explore dataset
  • Get idea about distribution

Intermediate Python

Histogram

  • Explore dataset
  • Get idea about distribution

Intermediate Python

Histogram

  • Explore dataset
  • Get idea about distribution

Intermediate Python

Histogram

  • Explore dataset
  • Get idea about distribution

Intermediate Python

Matplotlib

import matplotlib.pyplot as plt
help(plt.hist)
Help on function hist in module matplotlib.pyplot:
hist(x, bins=None, range=None, density=False, weights=None, 
cumulative=False, bottom=None, histtype='bar', align='mid', 
orientation='vertical', rwidth=None, log=False, color=None, 
label=None, stacked=False, *, data=None, **kwargs)
    Plot a histogram.

    Compute and draw the histogram of *x*.  The return value is a 
    tuple (*n*, *bins*, *patches*) or ([*n0*, *n1*, ...], 
    *bins*, [*patches0*, *patches1*, ...]) if the input contains 
    multiple data.
Intermediate Python

Matplotlib example

values = [0,0.6,1.4,1.6,2.2,2.5,2.6,3.2,3.5,3.9,4.2,6]

plt.hist(values, bins=3)
plt.show()

Intermediate Python

Population pyramid

Intermediate Python

Population pyramid

Intermediate Python

Let's practice!

Intermediate Python

Preparing Video For Download...