🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Technology & Design › Data Science & Analytics › Statistics for Data Science & Analytics › Lesson 2
TEC-DATA85-02 · Lesson 2 · 11 clock hours · demo

Data Distributions and Visualization of Shape

Objective. Students construct and interpret histograms, box plots, and frequency tables to describe the shape, center, and spread of a distribution.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

What Is a Distribution?

When you collect a set of numerical measurements — wages, trip durations, test scores — those values are rarely all the same. They spread out across a range, and that spread has a shape. A distribution describes how often each value (or range of values) occurs. Understanding the shape of a distribution tells you where most values cluster, how far values stray from the center, and whether unusual values (outliers) are present. These insights drive every downstream decision in data analysis, from choosing the right summary statistic to selecting the correct machine-learning algorithm.

Frequency Tables

The simplest way to summarize a numeric variable is a frequency table. You divide the range of the data into equal-width intervals called bins (or classes), then count how many observations fall into each bin. A relative frequency column shows each count as a proportion of the total, making tables from different datasets comparable. Frequency tables are your first sanity check: they reveal gaps, unexpected spikes, and impossible values before you ever draw a chart.

Histograms

A histogram is the visual version of a frequency table. Each bin becomes a bar; bar height encodes frequency or relative frequency. Unlike a bar chart for categorical data, histogram bars touch each other because the underlying variable is continuous.

Bin width matters. Too few bins (very wide bars) flatten the shape and hide structure. Too many bins (very narrow bars) produce a jagged, noisy picture. A common starting rule is to use roughly the square root of the number of observations as your bin count, then adjust visually. In pandas and seaborn you control this with the `bins` parameter.

```python

import pandas as pd

import seaborn as sns

import matplotlib.pyplot as plt

df = pd.read_csv('trips.csv')

sns.histplot(df['duration_min'], bins=30, kde=False)

plt.xlabel('Trip Duration (minutes)')

plt.ylabel('Count')

plt.title('Distribution of Ride-Share Trip Durations')

plt.show()

```

Always label axes and add a title. A chart without labels is professionally unacceptable and earns zero credit on rubrics.

Box Plots

A box plot (box-and-whisker plot) compresses the distribution into five summary values — the minimum, first quartile (Q1), median (Q2), third quartile (Q3), and maximum — plus individual points for outliers.

Box plots shine when you compare groups. Side-by-side box plots — one per day of the week, for example — let you spot whether Monday trips are longer than Saturday trips at a glance.

```python

sns.boxplot(data=df, x='day_of_week', y='duration_min',

order=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'])

plt.title('Trip Duration by Day of Week')

plt.show()

```

Describing Shape: Skewness and Symmetry

Once you see your histogram or box plot, describe the shape with standard vocabulary.

| Shape | What you see | Mean vs. Median |

|---|---|---|

| Symmetric (bell-shaped) | Mirror image left and right of center | Mean ≈ Median |

| Right-skewed (positive skew) | Long tail stretches to the right; bulk of data on the left | Mean > Median |

| Left-skewed (negative skew) | Long tail stretches to the left; bulk of data on the right | Mean < Median |

Why does skew affect the mean? The mean is pulled toward the tail because it uses every value in its calculation. The median, which is simply the middle-ranked value, resists the pull of extreme values. In right-skewed distributions such as income or trip duration, the median is usually a better representation of the "typical" value.

Outliers and Data-Quality Concerns

An outlier is a value that lies far from the bulk of the data. Outliers are not automatically errors — a genuinely long trip is real — but they deserve investigation. Ask:

1. Is this a data-entry or sensor error (a trip recorded as 9,000 minutes)?

2. Is it a legitimate rare event?

3. Does it belong to a different subpopulation?

Document your findings in a written reflection. Good analysts always note data-quality concerns rather than silently deleting rows.

Workplace Safety Note

Data science work is primarily office or remote-desktop work, but ergonomic and digital safety practices apply. Protect sensitive datasets (PII such as location traces in ride-share data) according to your organization's data governance policy. Never store real passenger data on a personal or unsecured device. When using shared JupyterHub servers, log out after each session and never share login credentials — credential sharing is a security violation equivalent to leaving a physical workstation unlocked.

Putting It All Together

For the lab exercise you will load the Chicago TNC trip dataset, inspect it with `df.describe()`, build a histogram with an appropriate bin count, then produce side-by-side box plots split by day of week. In your written reflection, name the shape of the overall distribution, explain what that shape implies for using the mean versus the median, and flag at least one data-quality concern you observe. Accurate axis labels, a descriptive title, and correct outlier identification are required to pass the 10-point rubric.

Key terms8

DistributionThe pattern that shows how often each value or range of values occurs in a dataset; described by shape, center, and spread.
HistogramA bar chart for continuous data in which each bar represents a bin (interval) and bar height shows frequency or relative frequency.
BinAn equal-width interval used to group continuous values when building a frequency table or histogram; also called a class.
Box plotA chart that displays the five-number summary (minimum, Q1, median, Q3, maximum) as a box and whiskers, with individual points marking outliers.
Interquartile Range (IQR)The difference between the third quartile (Q3) and the first quartile (Q1); measures the spread of the middle 50 % of the data.
SkewnessA measure of asymmetry in a distribution; a right-skewed (positive) distribution has a long tail to the right, while a left-skewed (negative) distribution has a long tail to the left.
OutlierA data value that lies unusually far from the bulk of the data; in a box plot, typically defined as a point more than 1.5 × IQR beyond Q1 or Q3.
Relative frequencyThe proportion of observations that fall in a given bin, calculated as the bin count divided by the total number of observations.

Worked examples4

1. A dataset of 8 trip durations (in minutes) is: 4, 7, 8, 9, 10, 11, 13, 38. Calculate Q1, Q3, and the IQR, then determine the outlier fence and identify any outliers.
  1. Step 1 — Order the values (already ordered): 4, 7, 8, 9, 10, 11, 13, 38.
  2. Step 2 — Find the median (Q2): With 8 values, the median is the average of the 4th and 5th values = (9 + 10) / 2 = 9.5 minutes.
  3. Step 3 — Find Q1 (median of the lower half: 4, 7, 8, 9): Q1 = (7 + 8) / 2 = 7.5 minutes.
  4. Step 4 — Find Q3 (median of the upper half: 10, 11, 13, 38): Q3 = (11 + 13) / 2 = 12 minutes.
  5. Step 5 — Calculate IQR: IQR = Q3 − Q1 = 12 − 7.5 = 4.5 minutes.
  6. Step 6 — Calculate the upper outlier fence: Q3 + 1.5 × IQR = 12 + 1.5 × 4.5 = 12 + 6.75 = 18.75 minutes.
  7. Step 7 — Calculate the lower outlier fence: Q1 − 1.5 × IQR = 7.5 − 6.75 = 0.75 minutes.
  8. Step 8 — Identify outliers: The value 38 exceeds the upper fence of 18.75, so 38 is an outlier. No values fall below 0.75.
Answer: Q1 = 7.5 min, Q3 = 12 min, IQR = 4.5 min. Upper fence = 18.75 min. The value 38 minutes is an outlier.
2. A frequency table for trip durations shows bins 0–5, 5–10, 10–15, 15–20, 20–25 with counts 2, 18, 55, 20, 5. Compute the relative frequency for each bin (total n = 100).
  1. Step 1 — Confirm total: 2 + 18 + 55 + 20 + 5 = 100. ✓
  2. Step 2 — Divide each count by 100: 0–5 → 2/100 = 0.02; 5–10 → 18/100 = 0.18; 10–15 → 55/100 = 0.55; 15–20 → 20/100 = 0.20; 20–25 → 5/100 = 0.05.
  3. Step 3 — Verify relative frequencies sum to 1.00: 0.02 + 0.18 + 0.55 + 0.20 + 0.05 = 1.00. ✓
  4. Step 4 — Describe shape: The tallest bar is in the center bin (10–15) with roughly equal counts on each side, suggesting an approximately symmetric, bell-shaped distribution.
Answer: Relative frequencies: 0.02, 0.18, 0.55, 0.20, 0.05. The distribution is approximately symmetric.
3. A dataset of 7 daily ride counts is: 120, 130, 125, 128, 200, 122, 126. Compare the mean and median. What does the difference suggest about the shape?
  1. Step 1 — Order values: 120, 122, 125, 126, 128, 130, 200.
  2. Step 2 — Find the median: With 7 values, the median is the 4th value = 126.
  3. Step 3 — Calculate the mean: Sum = 120 + 122 + 125 + 126 + 128 + 130 + 200 = 951. Mean = 951 / 7 ≈ 135.9.
  4. Step 4 — Compare: Mean (≈ 135.9) > Median (126). The mean is pulled upward by the high value of 200.
  5. Step 5 — Interpret shape: When mean > median, the distribution is right-skewed. The long tail extends to the right.
Answer: Median = 126; Mean ≈ 135.9. Because mean > median, the distribution is right-skewed; the value of 200 pulls the mean upward.
4. Using the IQR rule, determine the outlier fences for a dataset where Q1 = 22 minutes and Q3 = 40 minutes.
  1. Step 1 — Calculate IQR: IQR = Q3 − Q1 = 40 − 22 = 18 minutes.
  2. Step 2 — Calculate 1.5 × IQR: 1.5 × 18 = 27 minutes.
  3. Step 3 — Upper fence: Q3 + 27 = 40 + 27 = 67 minutes.
  4. Step 4 — Lower fence: Q1 − 27 = 22 − 27 = −5 minutes. Since trip durations cannot be negative, the effective lower fence is 0 minutes.
  5. Step 5 — Interpret: Any trip duration above 67 minutes would be flagged as an outlier in a box plot.
Answer: Lower fence = −5 min (effectively 0 for durations); Upper fence = 67 min. Trips exceeding 67 minutes are outliers.

The math in this lesson2

Learners build histograms and box plots and compute quartiles and IQR to describe shape.
S-ID.1S-ID.3
Brush up in the math halls at newSchoolWorks.com:
In class: Instructor live demo: build a histogram and box plot in Python (matplotlib/seaborn) from a real wages dataset; students replicate each step in their own Jupyter notebooks. · Lab exercise: students load a provided CSV of daily ride-share trip durations, choose appropriate bin widths, generate side-by-side box plots split by day of week, and annotate outliers. · Written reflection (one page): students describe the shape of their distribution (symmetric, left-skewed, right-skewed), explain what skew means for the mean vs. median, and note any data-quality concerns they observe.
Materials: Jupyter Notebook, Python 3 with pandas, matplotlib, seaborn; ride-share open dataset (e.g., Chicago TNC trip data); Anaconda or cloud-based JupyterHub
Check: Instructor reviews notebook output; students must produce correctly labeled histogram and box plot and correctly identify distribution shape and outlier direction; pass mark 70% on a 10-point rubric.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

Data Analysis and Statistics
1. A histogram of daily trip durations has a long tail extending to the right. Which statement best describes this distribution?
Data Analysis and Statistics
2. In a box plot, the interquartile range (IQR) represents which portion of the data?
Data Analysis and Statistics
3. A dataset has Q1 = 15 and Q3 = 35. Using the standard 1.5 × IQR rule, what is the upper outlier fence?
Data Visualization and Reporting
4. When building a histogram in Python using seaborn's histplot(), which parameter controls the number of bars displayed?
Data Analysis and Statistics
5. An analyst notices that the mean salary in a dataset is $85,000 while the median is $62,000. What does this suggest?
Data Visualization and Reporting
6. You are examining side-by-side box plots of trip durations for each day of the week. The Saturday box plot has several individual points plotted far above its upper whisker. What do those points represent?
Data Analysis and Statistics
7. A frequency table shows bins 0–10, 10–20, 20–30, 30–40 with counts 5, 40, 40, 15. Which choice best describes the shape of this distribution?
Data Governance and Quality
8. A ride-share dataset contains a trip duration of 9,000 minutes. Before deleting this row, what is the most professionally appropriate first action?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.