Skip to content
Worked Examples · Example 7.4

Q.In the above example, the minimum height value is 85 cm and the maximum height value is 115 cm. What is the range?

Puducherry TnboardTextbookSubjective· 2mImportance★★★★★
6% · 6/97 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

The range of a dataset is the difference between the maximum and minimum values; it measures the spread of the data in the same units as the original observations.

Why Range?

Range is the simplest measure of dispersion. While the mean tells you the central tendency, the range tells you how spread out your data is. A small range means the values cluster tightly; a large range means they are scattered.

The formula is straightforward:

Range=Maximum value−Minimum value\text{Range} = \text{Maximum value} - \text{Minimum value}

In the height example given, the tallest measurement is 115 cm115 \, \text{cm} and the shortest is 85 cm85 \, \text{cm}, so the range is 115−85=30 cm115 - 85 = 30 \, \text{cm}. This tells you that the heights vary by 30 cm30 \, \text{cm} across the group.

Computing Range in Python (Pandas)

Suppose you have a DataFrame with a column of heights:

import pandas as pd

# Sample data
data = {'Height_cm': [85, 90, 95, 100, 105, 110, 115]}
df = pd.DataFrame(data)

# Calculate range
height_range = df['Height_cm'].max() - df['Height_cm'].min()

print(f"Range of heights: {height_range} cm")

Output:

Range of heights: 30 cm

The .max() and .min() methods return the largest and smallest values in the Series, respectively. Subtracting them gives the range.

Computing Range in Python (NumPy)

If you're working with a NumPy array:

import numpy as np

heights = np.array([85, 90, 95, 100, 105, 110, 115])

height_range = np.ptp(heights)  # peak-to-peak

print(f"Range of heights: {height_range} cm")

Output:

Range of heights: 30 cm

The np.ptp() function (peak-to-peak) computes the range directly. …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.