Seoul public bike rentals and redistribution coverage

Summary

1,554 completed rentals per operating hour at 18:00 was the highest mean across recorded clock hours in SeoulBikeData.csv.

Weekday mean at 18:00

1,724.05 completed rentals per operating hour

Sum of Rented Bike Count divided by the number of operating rows, one per hour. Highest mean over the 24 recorded hour labels within Weekday.

Weekend mean at 17:00

1,161.01 completed rentals per operating hour

Sum of Rented Bike Count divided by the number of operating rows, one per hour. Highest mean over the 24 recorded hour labels within Weekend.

Median operating hour

542 completed rentals per operating hour

Quantile 0.5 of individual operating-hour counts, with linear interpolation.

Service suspension hours

295 hours

Count of No rows, one per recorded hour.

Use the weekday late-afternoon peak and broader weekend afternoon rise to prioritize coverage review. Weekday 08:00 is a distinct secondary window.

Charts

When are completed rentals most concentrated?

hourly-profile · n = 8465

Excluded 295 · Functioning Day = No on 295 rows.

When are completed rentals most concentrated?
Observation
SeoulBikeData.csv lines 2–8761 contributes 8,465 operating rows to 24 means per series after excluding 295 service suspension hours from the original CSV. At 18:00, 548,568 completed rentals across 353 operating hours give a pooled mean of 1,554.02. The weekday peak uses 432,737 rentals across 251 hours. The weekend peak uses 118,423 rentals across 102 hours.
Domain interpretation
Use the weekday late-afternoon peak and broader weekend afternoon rise to prioritize coverage review. Weekday 08:00 is a distinct secondary window.

How much do individual observations vary by recorded hour?

hourly-observations · n = 8465

Excluded 295 · Functioning Day = No on 295 rows.

How much do individual observations vary by recorded hour?
Observation
Each point is one of 8,465 operating-hour counts from SeoulBikeData.csv lines 2–8761. The upstream filter excluded 295 service suspension hours from the original CSV. The renderer excluded zero eligible rows. The highest observation was 3,556 completed rentals at recorded 18:00 on 19 June 2018 (line 4820).
Domain interpretation
Single-hour loads vary widely within the same clock hour.

How common are high-volume operating hours?

hourly-distribution · n = 8465

Excluded 295 · Functioning Day = No on 295 rows.

How common are high-volume operating hours?
Observation
The distribution uses 8,465 operating hours from SeoulBikeData.csv lines 2–8761, excluding 295 service suspension hours from the original CSV. The renderer excluded zero eligible rows. The middle half spans 214 to 1,084 completed rentals per operating hour.
Domain interpretation
The median describes a typical observation across operating hours. The upper tail gives context for busier hours.

Assumptions & limitations

  • The complete comma-delimited file decoded in Windows-1252, with 8,760 records and 14 fields. The CSV extension matches the content. All lines were read.
  • Dates parse day-first, from 1 December 2017 through 30 November 2018. Every recorded date has 24 distinct hour labels. Across the file there are zero blank cells, zero exact duplicate rows and zero duplicate Date and Hour keys.
  • All dates and hours used parsed successfully. All rental values are nonnegative integers with one consistent count unit. All 295 zero counts occur on suspension rows. Among operating rows, 152 counts exceeded the exploratory upper fence of 2,389 and were retained.
  • A05 records the unknown time zone. Clock labels and calendar day types follow the file. Verify the clock basis before mapping the profile to local rosters. Weekday means Monday through Friday and weekend means Saturday or Sunday. Holiday rows retain their recorded calendar day type.
  • Completed systemwide rentals are a proxy for service activity. Pickup timing, station-level flows, inventory, unmet demand and redistribution workload are unavailable in these records, so these comparisons identify candidate coverage windows. Crew sizes and routes require workload and station data.
  • Season comparisons describe this year's operating hours. Suspension timing and weekday mix can vary across seasons. The comparisons describe the observed grouping and cannot identify causes.
  • A compact season table provides exact comparisons with operating-hour denominators. A category-frequency chart would duplicate the suspension totals, and a weather-relationship plot answers a different decision question.
  • Totals, counts, quantiles and maxima are direct summaries, with no numerator or denominator fields. Hourly means use the same eligible rows for both components.

Ambiguity log

IDItemStatusAnswer
A01Business process and recording stageresolvedUser confirmed completed systemwide rentals per recorded hour. Rental start timing is unverified.
Evidence and options
question
Does Rented Bike Count represent rentals that started during the listed hour?
file_evidence
  • SeoulBikeData.csv line 2 contains Rented Bike Count = 254
candidates
  • Starts
  • Completions
affects
  • Interpretation of observed volume
A02DecisionresolvedUser requested typical demand comparisons for redistribution staffing.
Evidence and options
file_evidence
  • SeoulBikeData.csv lines 2–8761
affects
  • Coverage windows
A03Observation unitresolvedOne systemwide count per distinct Date and Hour, verified across 365 dates and confirmed by the user.
Evidence and options
file_evidence
  • SeoulBikeData.csv lines 2–8761
affects
  • Hourly denominators
A04Count unit and eligible denominatorresolvedUser selected operating hours for demand comparisons and asked to count suspension hours separately.
Evidence and options
question
Should operating-hour comparisons include No hours?
file_evidence
  • SeoulBikeData.csv line 3146 has Functioning Day = No and a zero count
candidates
  • Yes hours only
  • All hours
affects
  • Operating-hour means
  • Distribution
A05Time basisunresolvedUser does not know the time zone. The analysis groups by recorded date and hour labels.
Evidence and options
question
Should Date and Hour be interpreted as Seoul local time?
file_evidence
  • SeoulBikeData.csv line 2 has Date and Hour fields with no UTC offset
candidates
  • Seoul local time
  • Another or unknown clock basis
affects
  • Mapping recorded clock hours to local roster windows
A06Exceptions and normal rangesresolvedUser confirmed No marks suspension. The exploratory high-volume flag retains all observations and uses the operating distribution.
Evidence and options
file_evidence
  • SeoulBikeData.csv lines 3146–3169, 3842–3865, 6986–7033, 7226–7249, 7274–7297, 7322–7345, 7370–7393, 7418–7424, 7490–7513, 8090–8113, 8162–8185, 8234–8257
  • SeoulBikeData.csv line 4820 contains the largest observed count
affects
  • Suspension summary
  • High-volume diagnostic
A07Missing values and zerosresolvedNo blank cells. Every zero in the rental count occurs on a No row. These rows are used for suspension time and are outside the volume analysis.
Evidence and options
file_evidence
  • SeoulBikeData.csv lines 2–8761
affects
  • Operating-hour scope
A08Join keysnot_applicableSingle table with no joins.
Evidence and options
file_evidence
  • SeoulBikeData.csv lines 2–8761

Data overview

row_grain
One systemwide observation per recorded Date and Hour. User confirmed that the counts represent completed rentals.
datasets
  • id
    text:1
    format
    CSV
    read_ranges
    • SeoulBikeData.csv lines 1–8761, with field names on line 1.
    rows
    8760
    columns
    14

Metrics

MetricValueDefinitionNumeratorDenominatorConditionSources
Overall mean at 18:001,554.02 completed rentals per operating hourSum of Rented Bike Count divided by the number of operating rows, one per hour. Highest mean over the 24 recorded hour labels within all operating dates.548,568353
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761, filtered to Hour = 18
Weekday mean at 18:001,724.05 completed rentals per operating hourSum of Rented Bike Count divided by the number of operating rows, one per hour. Highest mean over the 24 recorded hour labels within Weekday.432,737251
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761, filtered to Hour = 18 and Day type = Weekday
Weekend mean at 17:001,161.01 completed rentals per operating hourSum of Rented Bike Count divided by the number of operating rows, one per hour. Highest mean over the 24 recorded hour labels within Weekend.118,423102
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761, filtered to Hour = 17 and Day type = Weekend
Overall operating-hour mean729.16 completed rentals per operating hourSum of Rented Bike Count divided by the number of operating rows, one per hour. All dates in the source.6,172,3148,465
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761
Weekday mean at 08:001,306.02 completed rentals per operating hourSum of Rented Bike Count divided by the number of operating rows, one per hour. Weekday operating rows at Hour = 8.327,810251
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761, filtered to Hour = 8 and Day type = Weekday
Weekend mean at 08:00420.79 completed rentals per operating hourSum of Rented Bike Count divided by the number of operating rows, one per hour. Weekend operating rows at Hour = 8.42,921102
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761, filtered to Hour = 8 and Day type = Weekend
Spring operating-hour mean746.25 completed rentals per operating hourSum of Rented Bike Count divided by the number of operating rows, one per hour. Operating rows labeled Spring.1,611,9092,160
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761, filtered to Seasons = Spring
Summer operating-hour mean1,034.07 completed rentals per operating hourSum of Rented Bike Count divided by the number of operating rows, one per hour. Operating rows labeled Summer.2,283,2342,208
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761, filtered to Seasons = Summer
Autumn operating-hour mean924.11 completed rentals per operating hourSum of Rented Bike Count divided by the number of operating rows, one per hour. Operating rows labeled Autumn.1,790,0021,937
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761, filtered to Seasons = Autumn
Winter operating-hour mean225.54 completed rentals per operating hourSum of Rented Bike Count divided by the number of operating rows, one per hour. Operating rows labeled Winter.487,1692,160
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761, filtered to Seasons = Winter
25th percentile214 completed rentals per operating hourQuantile 0.25 of individual operating-hour counts, with linear interpolation.
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761
Median operating hour542 completed rentals per operating hourQuantile 0.5 of individual operating-hour counts, with linear interpolation.
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761
75th percentile1,084 completed rentals per operating hourQuantile 0.75 of individual operating-hour counts, with linear interpolation.
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761
90th percentile1,696.6 completed rentals per operating hourQuantile 0.9 of individual operating-hour counts, with linear interpolation.
  • SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761
Service suspension hours295 hoursCount of No rows, one per recorded hour.
  • SeoulBikeData.csv lines 3146–3169, 3842–3865, 6986–7033, 7226–7249, 7274–7297, 7322–7345, 7370–7393, 7418–7424, 7490–7513, 8090–8113, 8162–8185, 8234–8257
Dates affected by suspensions13 recorded datesCount of distinct recorded dates with at least one No hour.
  • SeoulBikeData.csv lines 3146–3169, 3842–3865, 6986–7033, 7226–7249, 7274–7297, 7322–7345, 7370–7393, 7418–7424, 7490–7513, 8090–8113, 8162–8185, 8234–8257
Fully suspended dates12 recorded datesCount of recorded dates with all 24 rows marked No.
  • SeoulBikeData.csv lines 3146–3169, 3842–3865, 6986–7033, 7226–7249, 7274–7297, 7322–7345, 7370–7393, 7418–7424, 7490–7513, 8090–8113, 8162–8185, 8234–8257
Maximum observed hourly count3,556 completed rentalsLargest single operating-hour count in the supplied year.
  • SeoulBikeData.csv line 4820

Reproducibility

filters
  • Functioning Day = Yes for all demand comparisons.
  • Functioning Day = No for suspension counts.
exclusions
  • scope
    Operating-hour demand analysis and all three figures
    source_refs
    • SeoulBikeData.csv lines 3146–3169, 3842–3865, 6986–7033, 7226–7249, 7274–7297, 7322–7345, 7370–7393, 7418–7424, 7490–7513, 8090–8113, 8162–8185, 8234–8257
    reason
    Functioning Day = No on 295 rows.
transforms
  • input
    CSV
    transform
    Read complete table, keep source line and parse book-keeping fields
    output
    Recorded hours
    before
    8760
    after
    8760
  • input
    Recorded hours
    transform
    Select Functioning Day = Yes
    output
    Operating hours
    before
    8760
    after
    8465
  • input
    Recorded hours
    transform
    Select Functioning Day = No
    output
    Suspension hours
    before
    8760
    after
    295
  • input
    Operating hours
    transform
    Group by recorded Hour for the pooled profile
    output
    Pooled hour groups
    before
    8465
    after
    24
  • input
    Operating hours
    transform
    Group by recorded day type and Hour
    output
    Day type hour groups
    before
    8465
    after
    48
  • input
    Operating hours
    transform
    Group by supplied Seasons label
    output
    Season groups
    before
    8465
    after
    4
sample_sizes
Recorded hours
8760
Operating hours
8465
Suspension hours
295
Weekday operating hours
6024
Weekend operating hours
2441
hourly-profile
8465
hourly-observations
8465
hourly-distribution
8465
source_locators
  • SeoulBikeData.csv lines 2–8761, with headers on line 1.
  • Operating source rows: SeoulBikeData.csv lines 2–3145, 3170–3841, 3866–6985, 7034–7225, 7250–7273, 7298–7321, 7346–7369, 7394–7417, 7425–7489, 7514–8089, 8114–8161, 8186–8233, 8258–8761.
  • Suspension source rows: SeoulBikeData.csv lines 3146–3169, 3842–3865, 6986–7033, 7226–7249, 7274–7297, 7322–7345, 7370–7393, 7418–7424, 7490–7513, 8090–8113, 8162–8185, 8234–8257.

Code

# From eda-work, run with Python 3.10+ and the supplied skill environment.
# python3 -I ../eda-skill/scripts/inspect_data.py ../SeoulBikeData.csv --out inspection.json
# python3 -I analyze.py
# python3 -I ../eda-skill/scripts/plots.py --spec plot-spec.json --outdir delivery/figures > plot-results.json
# python3 -I prepare_report.py
# python3 -I ../eda-skill/scripts/build_report.py --spec report-spec.json --outdir delivery

import json
from pathlib import Path

import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import pandas as pd

source = "../SeoulBikeData.csv"
count = "Rented Bike Count"
state = "Functioning Day"
df = pd.read_csv(source, encoding="cp1252", dtype=str, keep_default_na=False)
df.index = pd.Index(range(2, len(df) + 2), name="_source_row")
blank = df.eq("")
assert not blank.any().any()
assert not df.duplicated().any()
date = pd.to_datetime(df["Date"], format="%d/%m/%Y", errors="raise")
hour = pd.to_numeric(df["Hour"], errors="raise")
volume = pd.to_numeric(df[count], errors="raise")
assert (hour % 1 == 0).all() and hour.between(0, 23).all()
assert (volume % 1 == 0).all() and volume.ge(0).all()
times = pd.DatetimeIndex(date + pd.to_timedelta(hour, unit="h"))
assert times.equals(pd.date_range(times.min(), times.max(), freq="h"))
assert set(df[state]) == {"Yes", "No"}
assert volume.eq(0).equals(df[state].eq("No"))
hourly = df.assign(Date=date, Hour=hour, **{count: volume})
hourly["Day type"] = date.dt.day_of_week.ge(5).map({True: "Weekend", False: "Weekday"})
operating = hourly.loc[df[state].eq("Yes")]
suspended = hourly.loc[df[state].eq("No")]
assert len(operating) + len(suspended) == len(df)
assert operating[count].sum() + suspended[count].sum() == volume.sum()

def summarize(rows, by):
    return rows.groupby(by)[count].agg(
        total="sum", hours="size", mean="mean", median="median",
        p90=lambda values: values.quantile(.9),
    )

all_hours = summarize(operating, "Hour")
day_hours = summarize(operating, ["Day type", "Hour"])
season = summarize(operating, "Seasons")
print(all_hours.round(2).to_string())
print(day_hours.groupby(level=0)["mean"].nlargest(5).round(2))
print(season.round(2))
print(operating[count].quantile([.25, .5, .75, .9]))
print("Peak observed:", operating.loc[operating[count].idxmax(), ["Date", "Hour", count]].to_dict(), operating[count].idxmax())
print("Suspensions:", suspended["Date"].nunique(), "dates;", suspended.groupby("Date").size().eq(24).sum(), "full dates")
print(hourly.groupby(["Day type", state]).size())
quartiles = operating[count].quantile([.25, .75])
iqr = quartiles.loc[.75] - quartiles.loc[.25]
upper_fence = quartiles.loc[.75] + 1.5 * iqr
print("Upper fence:", upper_fence, "Flagged:", operating[count].gt(upper_fence).sum())
print("Weekday 8 / weekend 8:", day_hours.loc[("Weekday", 8)].to_dict(), day_hours.loc[("Weekend", 8)].to_dict())

out = Path("delivery/figures")
out.mkdir(parents=True, exist_ok=True)
fig, ax = plt.subplots(figsize=(10, 5), layout="constrained")
ax.set_axisbelow(True)
ax.grid(axis="y", color="#e0e7ef")
ax.plot(all_hours.index, all_hours["mean"], label="All operating hours", color="#34445a", linestyle="--", linewidth=1.8)
for day, color, marker in [("Weekday", "#17699e", "o"), ("Weekend", "#ab4a16", "s")]:
    group = day_hours.loc[day]
    ax.plot(group.index, group["mean"], label=day, color=color, marker=marker, markersize=3.5, linewidth=2)
    peak = group["mean"].idxmax()
    ax.scatter(peak, group.loc[peak, "mean"], color=color, marker=marker, s=60, zorder=3)
ax.set(xlim=(-0.25, 23.25), ylim=(0, None), xticks=range(24),
       xlabel="Recorded hour (time zone unknown)", ylabel="Mean completed rentals per operating hour",
       title="When are completed rentals most concentrated?")
ax.spines[["top", "right"]].set_visible(False)
ax.legend(frameon=False, loc="upper left")
fig.savefig(out / "hourly-profile.png", dpi=160)
plt.close(fig)

operating.reset_index().to_csv("operating-for-plots.csv", index=False)
plot_spec = {
    "source": {"path": "operating-for-plots.csv", "table_id": "text:1", "header": True},
    "charts": [
        {"id": "hourly-observations", "type": "scatter", "x": "Hour", "y": count,
         "title": "How much do individual observations vary by recorded hour?",
         "x_label": "Recorded hour (time zone unknown)", "y_label": "Completed rentals", "y_unit": "rentals per hour"},
        {"id": "hourly-distribution", "type": "histogram", "column": count, "bins": 24,
         "title": "How common are high-volume operating hours?",
         "x_label": "Completed rentals per operating hour", "y_label": "Number of operating hours"},
    ],
}
Path("plot-spec.json").write_text(json.dumps(plot_spec, indent=2), encoding="utf-8")


# Report metric definitions and source mapping
import json
from itertools import groupby
from pathlib import Path
from runpy import run_path

data = run_path("analyze.py")
df = data["df"]
operating = data["operating"]
suspended = data["suspended"]
all_hours = data["all_hours"]
day_hours = data["day_hours"]
season = data["season"]
count = data["count"]
state = data["state"]
source = "SeoulBikeData.csv"
full = f"{source} lines 2–{len(df) + 1}"
inspection = json.loads(Path("inspection.json").read_text())
table = inspection["tables"][0]
assert table["locator"]["line_range"] == [1, len(df) + 1]
assert table["n_cols"] == len(df.columns)
assert table["n_rows"] == len(df)
assert not inspection["read_extent"]["unread"]
assert [c["name"] for c in table["columns"]] == list(df.columns)

def ranges(rows):
    spans = []
    for _, group in groupby(enumerate(rows.index), lambda pair: pair[1] - pair[0]):
        block = [line for _, line in group]
        spans.append(str(block[0]) if len(block) == 1 else f"{block[0]}–{block[-1]}")
    return f"{source} lines " + ", ".join(spans)

open_ref = ranges(operating)
closed_ref = ranges(suspended)
metrics = []

def metric(name, definition, value, unit, refs, numerator=None, denominator=None):
    metrics.append(dict(name=name, definition=definition, value=value, unit=unit,
                        numerator=numerator, denominator=denominator, source_refs=refs,
                        depends_on_ambiguity_ids=[], condition=None))
    return value

def mean(name, rows, selection, source_ref):
    total = int(rows[count].sum())
    hours = len(rows)
    return metric(name, f"Sum of {count} divided by the number of operating rows, one per hour. {selection}.",
                  total / hours, "completed rentals per operating hour", [source_ref], total, hours)

def peak(group):
    stats = all_hours if group is None else day_hours.loc[group]
    hour = int(stats["mean"].idxmax())
    rows = operating.loc[operating["Hour"].eq(hour)]
    if group is not None:
        rows = rows.loc[rows["Day type"].eq(group)]
    value = mean(f"{group or 'Overall'} mean at {hour:02}:00", rows,
                 f"Highest mean over the 24 recorded hour labels within {group or 'all operating dates'}",
                 f"{open_ref}, filtered to Hour = {hour}" + (f" and Day type = {group}" if group else ""))
    point = stats.loc[hour]
    assert value == point["mean"] and len(rows) == point["hours"]
    return hour, int(point["total"]), int(point["hours"]), value

overall_peak = peak(None)
weekday_peak = peak("Weekday")
weekend_peak = peak("Weekend")
mean("Overall operating-hour mean", operating, "All dates in the source", open_ref)

for group in ("Weekday", "Weekend"):
    rows = operating.loc[operating["Hour"].eq(8) & operating["Day type"].eq(group)]
    mean(f"{group} mean at 08:00", rows, f"{group} operating rows at Hour = 8",
         f"{open_ref}, filtered to Hour = 8 and Day type = {group}")

for label in ("Spring", "Summer", "Autumn", "Winter"):
    rows = operating.loc[operating["Seasons"].eq(label)]
    result = mean(f"{label} operating-hour mean", rows, f"Operating rows labeled {label}",
                  f"{open_ref}, filtered to Seasons = {label}")
    assert result == season.loc[label, "mean"]

for label, q in (("25th percentile", .25), ("Median operating hour", .5),
                 ("75th percentile", .75), ("90th percentile", .9)):
    metric(label, f"Quantile {q:g} of individual operating-hour counts, with linear interpolation.",
           float(operating[count].quantile(q)), "completed rentals per operating hour", [open_ref])
metric("Service suspension hours", "Count of No rows, one per recorded hour.",
       len(suspended), "hours", [closed_ref])
closed_by_date = suspended.groupby("Date").size()
metric("Dates affected by suspensions", "Count of distinct recorded dates with at least one No hour.",
       len(closed_by_date), "recorded dates", [closed_ref])
metric("Fully suspended dates", "Count of recorded dates with all 24 rows marked No.",
       int(closed_by_date.eq(24).sum()), "recorded dates", [closed_ref])
max_row = int(operating[count].idxmax())
max_value = int(operating.loc[max_row, count])
metric("Maximum observed hourly count", "Largest single operating-hour count in the supplied year.",
       max_value, "completed rentals", [f"{source} line {max_row}"])

assert not operating.duplicated(["Date", "Hour"]).any()
assert all_hours["hours"].sum() == day_hours["hours"].sum() == season["hours"].sum() == len(operating)
assert all_hours["total"].sum() == day_hours["total"].sum() == season["total"].sum() == operating[count].sum()
assert operating["Holiday"].isin(["Holiday", "No Holiday"]).all()
excluded = f"{len(suspended):,} service suspension hours from the original CSV."
status_reason = f"Functioning Day = No on {len(suspended):,} rows."
h, total, n, v = overall_peak
wh, wt, wn, wv = weekday_peak
eh, et, en, ev = weekend_peak
profile_id = "hourly-profile"

chart_meta = {c["id"]: c for c in json.loads(Path("plot-results.json").read_text())}
for c in chart_meta.values():
    assert c["n_used"] == len(operating) and c["n_excluded"] == 0
    assert not c["missing_glyphs"] and not c["source_warnings"]
    assert c["source_table_id"] == "text:1" and not c["read_extent"]["unread"]

def chart(chart_id, question, observation, interpretation):
    meta = chart_meta[chart_id]
    return dict(id=chart_id, question=question, type=meta["type"], source_columns=meta["source_columns"],
                image_path=f"delivery/figures/{Path(meta['image_path']).name}", n_used=meta["n_used"],
                n_excluded=len(suspended), exclusion_reason=status_reason, observation=observation,
                domain_interpretation=interpretation, rendering_exclusions=meta["n_excluded"])

def log(i, item, evidence, status, answer, affects, question=None, candidates=()):
    return dict(id=f"A{i:02}", checklist_item=item, question=question, file_evidence=evidence,
                candidates=list(candidates), status=status, answer=answer, affects=affects)