liveBook · Manning

Box-and-whisker plot

As explained in Starting Data Analytics with Generative AI and Python

A box plot is a statistical chart that summarizes a numerical distribution using quartiles, a median, and potential extremes.

When numerical data may contain entry errors, bias, or unusual values, a box-and-whisker plot gives a compact view of its distribution. It summarizes quartiles, the median, and potential extremes so you can question patterns before choosing statistical tests or models. section 2.6.1

Use it alongside a histogram rather than treating it as proof. For example, calculate the time between review creation and answer, inspect the distribution, and investigate unusually long response times against the original records. section 2.6.3

A practical inspection workflow is:

  • Calculate the difference between the two timestamps and choose a useful unit, such as hours or days. section 2.6.3
  • Review descriptive statistics, then compare a histogram with the box plot. section 2.6.3
  • Validate apparent outliers and trends against review scores, time periods, or raw records before drawing conclusions. section 2.6.1 section 2.6.3
import matplotlib.pyplot as plt
# Histogram
df_order_reviews['time_diff'].plot(kind='hist', bins=50)
plt.xlabel('Time Difference (Seconds)')
plt.ylabel('Frequency')
plt.title('Distribution of Time Difference Between Review Creation and 
Answer')
plt.show()

# Box plot
df_order_reviews['time_diff'].plot(kind='box', vert=False)
plt.xlabel('Time Difference (Seconds)')
plt.title('Box Plot of Time Difference Between Review Creation and
Answer')
plt.show()

Inspect the Python listing that creates a histogram and a horizontal box plot for timestamp differences. section 2.6.3

How Starting Data Analytics with Generative AI and Python covers it

How deep it goes
Shows a practical plotting workflow and interpretation of outliers, but defers formal distribution tests and deeper statistical theory.
Examples
Uses review-answer response times, descriptive statistics, timestamp differences, histograms, and horizontal box plots.
What it assumes
Assumes tabular data with numerical or timestamp fields and introduces distribution inspection through concrete calculations and plots.
What you can do after
Apply it via matplotlib to inspect numerical distributions and investigate potential outliers or trends.
How it connects
Connects box plots with histograms, density plots, Q-Q plots, distribution tests, outliers, and data quality.

Also explained in

Compare how 6 books explain box-and-whisker plot →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Starting Data Analytics with Generative AI and Python. The section links point to the parts of the book it draws on.