Datasets / Hormuz shipping crisis
Daily transits through the strait, pre-war to crisis
Transits run flat until the closure, then step down and stay down: the period_type column marks the day the regime changes.
How it decided
Hormuz shipping crisis: 125 rows, 26 columns. date, period_type and daily_ship_transits.
125 rows in, 125 out across 3 columns. Transits run flat until the closure, then step down and stay down: the period_type column marks the day the regime changes.
line. A daily series with a step change reads best as a line; the period split names the two regimes instead of a guessed annotation.
Palette, spacing, axis titles and legend placement applied. 0 issues found.
The transformation
This is the code, not a description of it — the chart above was drawn from what it returns, and the notebook download runs the same lines against the same file.
df["date"] = pd.to_datetime(df["date"])
result = df.groupby(["date", "period_type"], as_index=False)["daily_ship_transits"].sum()
What it charted
125 rows out of 125, 3 columns. First 8 shown.
| date | period_type | daily_ship_transits |
|---|---|---|
| 2026-01-01 | pre_war | 103 |
| 2026-01-02 | pre_war | 108 |
| 2026-01-03 | pre_war | 108 |
| 2026-01-04 | pre_war | 108 |
| 2026-01-05 | pre_war | 98 |
| 2026-01-06 | pre_war | 98 |
| 2026-01-07 | pre_war | 106 |
| 2026-01-08 | pre_war | 97 |