Data Science

Histograms: Seeing the Distribution

SQL Mastery Team
May 30, 2026
5 min read

It's **Day 129**, and we're talking about "Spread."

The Difference

  • **Bar Chart**: Categories on X (e.g., London, Paris).
  • **Histogram**: Continuous numbers on X (e.g., Age 0-10, 10-20).
  • The Concept of "Bins"

    A histogram takes a list of numbers and counts how many fall into specific buckets (Bins).

    ages = [22, 25, 22, 31, 35, 40, 42, 50, 65]

    plt.hist(ages, bins=5, edgecolor='black')

    plt.title("Age Distribution of Users")

    plt.show()

    Why Analysts use this

    Histograms help identify **Outliers** and **Skewness**. If most of your customers are aged 20-30 but you have one 90-year-old, the histogram will show a long "Tail" to the right.

    Your Task for Today

    Create a histogram for a list of 50 random numbers and experiment with the `bins` parameter (try 5, 10, and 20).

    *Day 130: Scatter Plots: Finding Relationships.*

    Ready to put your knowledge into practice?

    Join SQL Mastery and learn through interactive exercises.