Blog

Pedestrian Crashes After Sunset: Japan and UK Data

Is it rush hour or darkness? 1.18 million crashes in Japan show the pedestrian share jumping 15–30 min after sunset, and UK casualties rising 43% after the clocks go back.

Line chart of the share of crashes involving a pedestrian by minutes from sunset (15-minute bins) in Japan and the UK, counting only crashes on weekdays between 16:30 and 18:29. In Japan the share is 9–11% before sunset, jumps to 20% at 15–30 minutes after sunset and stays at 21–24%. In the UK it is 16–19% before sunset and 24–26% from 30 minutes after sunset. The roughly 30 minutes after sunset are shaded as twilight.
Compiled by the author from the National Police Agency of Japan's traffic accident open data (2022–2025) and the UK Department for Transport's Road Safety Data (STATS19, 2021–2025). Sunset times were calculated from each crash's latitude and longitude.
Contents

Five in the afternoon in December. In Tokyo the sun has long gone down and cars are driving with their headlights on. At the same moment in Fukuoka, on the island of Kyushu in western Japan, the western sky is still bright. Japan runs on a single time zone, so offices and schools let out at roughly the same clock time across the country, but sunset in the east and west differs by more than 40 minutes.

That gap makes it possible to separate the two usual explanations for why pedestrian crashes rise on winter evenings: rush hour puts more people and cars on the road, and darkness makes pedestrians harder to see. Put Tokyo and Fukuoka side by side, with the same clocks but different light, and you should be able to tell which one is doing the work.

I took every injury crash in the open data published by Japan’s National Police Agency (2022–2025, 1.18 million crashes) and re-sorted them by the sunset time calculated for each crash’s location and date. One result up front: in the 30 minutes from 17:00 on winter weekdays, the share of crashes involving a pedestrian in the Tokyo area was already 1.6 times its midday level, while in Fukuoka Prefecture it was the same as midday (0.97 times). Fukuoka catches up 30 minutes later, once its own sunset has passed. Crashes were following the sun, not the clock.

I also checked a country that moves the clock itself by an hour. The UK ends British Summer Time on the last Sunday of October and turns the clocks back one hour, so the very next evening is suddenly an hour darker. In the UK Department for Transport’s crash statistics, evening pedestrian casualties rose from 14.3 to 20.5 per day in the two weeks after the change compared with the two weeks before, and the direction was the same in all five years.

What I counted: other crashes at the same time and place as the yardstick

Before the numbers, a word on what was counted. Comparing raw counts of evening pedestrian crashes would mostly measure differences in traffic. Winter and summer, Tokyo and Fukuoka, all have different numbers of people walking and cars driving, and there is no national data on pedestrian or vehicle volumes by time of day.

So the yardstick is the share of all crashes at the same time and place that involved a pedestrian (the “pedestrian vs. vehicle” category in the police data). Crashes between vehicles rise when there are more vehicles. Pedestrian crashes rise when there are more pedestrians and more vehicles, and should also be hit harder by poor visibility. Changes in traffic volume partly cancel out, so if the share moves a lot, something other than traffic is singling out pedestrians.

Sunset was calculated for each crash from the location’s latitude and longitude and the date, using the approximation published by the US National Oceanic and Atmospheric Administration (NOAA). The Japanese data also record a sunset time for each crash, and the calculated value was within 5 minutes of it for 99.1% of crashes. The UK data have no sunset times, so the same formula was used there.

Data Period Crashes Crashes involving pedestrians
National Police Agency of Japan, traffic accident open data (main table) 2022–2025 1,178,201 injury crashes 152,702 pedestrian vs. vehicle
UK Department for Transport, Road Safety Data (STATS19) 2021–2025 513,748 injury crashes 90,715 with a pedestrian casualty

At the same weekday 17:00 hour, darkness makes the pedestrian share 2.4 times higher

The first step is to strip out rush hour as far as possible and look at darkness alone. I took only crashes on weekdays (excluding public holidays and the days before them) between 17:00 and 17:59, and split them into “light” crashes, at least 30 minutes before sunset, and “dark” crashes, at least 30 minutes after sunset. The 17:00 hour is light in summer and dark in winter, so this compares crashes at the same clock time that differ only in light.

Weekday crashes, 17:00 hour Japan: crashes Japan: pedestrian share UK: crashes UK: pedestrian share
Light (30+ min before sunset) 37,923 9.2% 21,896 15.3%
Dark (30+ min after sunset) 19,616 21.9% 10,923 24.1%
Dark ÷ light 2.4× 1.6×

In Japan, more than one in five crashes in the 17:00 hour involved a pedestrian when it was dark, 2.4 times the share when it was light. Broken down by month, the share clearly tracks the time of sunset.

Month Median sunset, weekday 17:00-hour crashes Pedestrian share, 17:00 hour For reference: 12:00–14:59
June 19:06 8.9% 9.9%
September 18:02 10.6% 9.5%
October 17:12 17.6% 11.3%
November 16:44 20.9% 11.8%
December 16:40 20.8% 12.4%
January 17:00 18.4% 11.4%
February 17:29 13.3% 11.7%

The midday share barely moves all year, staying between 9% and 12%, but the 17:00-hour share leaps from 10.6% in September to 17.6% in October. Rush hour does not shift between September and October. What changes is whether the 17:00 hour falls before or after sunset.

So how many minutes after dark does the effect kick in? This time I kept the clock fixed at weekdays 16:30–18:29 and split crashes into 15-minute bins by time from sunset (the chart at the top). In Japan the share runs flat at 9–11% before sunset, then goes to 14% at 0–15 minutes after sunset and 20% at 15–30 minutes, roughly doubling within 15 minutes. The first 30 minutes or so after sunset are civil twilight, when the sky stays bright even though the sun is down. While eyes adjust and people feel they “can still see”, the actual light drops quickly. The pedestrian share steps up right around the end of twilight and stays high after that.

Line chart of the share of crashes involving a pedestrian by minutes from sunset (15-minute bins) in Japan and the UK, counting only weekday crashes from 16:30 to 18:29. Japan is 9–11% before sunset, 14% at 0–15 minutes after and 20% at 15–30 minutes after. The UK is 16–19% before sunset and 24–26% from 30 minutes after.
Compiled by the author from the National Police Agency of Japan's traffic accident open data (2022–2025) and UK DfT STATS19 (2021–2025). Sunset times were calculated from each crash's latitude, longitude and date.

At 5 p.m. in winter, the Tokyo area is already in night and Fukuoka is still in day

The comparison so far includes the difference between summer and winter. In summer the days are longer, but clothing and the mix of people out and about are different too. To hold the season fixed completely, you compare places on the same day at the same clock time that differ only in light. This is where Tokyo and Fukuoka come in.

For weekdays from November to January, I split crashes in the Tokyo area (Tokyo, Saitama, Chiba and Kanagawa prefectures), the Osaka area (Kyoto, Osaka, Hyogo and Nara) and Fukuoka Prefecture into 30-minute bins and turned the pedestrian share into an index, with each region’s midday (10:00–14:59) value set to 1. Road conditions and the amount of walking differ by region, so the comparison is against each region’s own midday. Median sunset over this period was 16:34 in the Tokyo area, 16:54 in the Osaka area and 17:16 in Fukuoka, a 42-minute gap between the Tokyo area and Fukuoka.

Line chart of the pedestrian crash share in 30-minute bins on November–January weekdays, as an index with midday 10:00–14:59 set to 1, for the Tokyo area, the Osaka area and Fukuoka Prefecture. The Tokyo area (sunset 16:34) rises to 1.58 at 17:00–17:29. The Osaka area (sunset 16:54) is 1.47 at 17:00–17:29 and 1.7–1.8 from 17:30. Fukuoka (sunset 17:16) is 0.97 at 17:00–17:29, the same as midday, then 1.44 at 17:30 and around 1.7 from 18:00.
Compiled by the author from the National Police Agency of Japan's traffic accident open data (November–January weekdays, 2022–2025). Dashed lines show the median sunset time calculated at the crash locations in each region.
Nov–Jan weekdays Sunset (median) 16:30–16:59 17:00–17:29 17:30–17:59 18:00–18:29
Tokyo area 16:34 1.28 1.58 1.48 1.56
Osaka area 16:54 1.05 1.47 1.74 1.80
Fukuoka 17:16 1.29 0.97 1.44 1.68

In the 30 minutes from 17:00, the pedestrian share in the Tokyo area is already 1.58 times midday, while Fukuoka is at 0.97, no different from midday. Fukuoka only passes 1.4 from 17:30, after its sunset, and the time the share starts rising moves from east to west in the order of sunset. If rush hour were the cause, all three regions would rise together at the same clock time.

To be honest about it, Fukuoka has only a few hundred crashes in each 30-minute bin, so its line is quite jagged. Year by year, Fukuoka’s index for 17:00–17:29 swings between 0.5 and 1.3, and in the winter of fiscal 2023 alone it was high at 1.32. The Tokyo area, meanwhile, was 1.43–1.76 in all five seasons (the first and last cover only one or two months), higher than Fukuoka every year. Rather than fixing on any single number, read the order: the Tokyo area peaks first and Fukuoka later.

As an aside, an office worker in Tokyo who heads home thinking “it’s only five, I’ll make it while it’s light” is, by Fukuoka standards, walking a fully dark street. Japan Standard Time is set at 135°E, the meridian through Akashi in Hyogo Prefecture, so Tokyo’s clocks run about 20 minutes behind the sun, while Fukuoka’s run about 20 minutes ahead.

When the clocks went back an hour, evening pedestrian casualties rose 40% the following weeks

The east–west comparison is within a single day, but it cannot fully remove regional differences. A cleaner experiment exists in countries that move the clock itself. The UK is on British Summer Time from late March to late October and turns the clocks back one hour on the last Sunday of October. The next Monday at 17:00 is an hour darker than 17:00 the week before, while the season has moved on by just a day, so people’s movements are almost the same.

Using the UK Department for Transport’s crash statistics (STATS19), I compared weekdays in the two weeks before and after the clock change for 2021–2025. Here the count is the number of pedestrian casualties.

UK, two weeks either side of the autumn clock change (weekdays, 5 years combined) Before After Change
Pedestrian casualties, 16:00–18:59 (per day) 14.3 20.5 +43%
Pedestrian casualties, 10:00–14:59 (per day) 14.1 15.2 +8%
Pedestrians killed or seriously injured, 16:00–18:59 (total) 193 361 1.9×

Midday casualties rose only 8%, but evening casualties rose 43%. For killed or seriously injured, it nearly doubled. Calculating the evening-to-midday ratio for each year, it rose by 0.25–0.42 after the change in all five years.

Dot plot of the ratio of pedestrian casualties between 16:00–18:59 and 10:00–14:59 on weekdays in the two weeks before and after the UK clocks went back on the last Sunday of October, by year. 2021 went from 1.12 to 1.45, 2022 from 0.95 to 1.29, 2023 from 1.07 to 1.49, 2024 from 0.85 to 1.17 and 2025 from 1.09 to 1.34, higher after the change in all five years.
Compiled by the author from UK Department for Transport, Road Safety Data (STATS19) 2021–2025 (Open Government Licence v3.0). Weekdays in the 14 days before and the 14 days after the change.

One caveat: in some years the UK clock change coincides with the autumn school half-term in the week before or after, and the numbers for the morning school run swung widely from year to year. The spring change also overlaps with Easter holidays, so this article treats only the autumn evening as a result.

Japan shows a bigger light-versus-dark gap than the UK, and I can’t say why yet

Comparing Japan and the UK, I expected dusk to matter more in the UK. Winter sunset there comes before 16:00 and, at a higher latitude, twilight lasts longer. The result was the opposite. In the weekday 17:00-hour comparison, the pedestrian share in the dark was 2.4 times the share in the light in Japan and 1.6 times in the UK. By minutes from sunset, the ratio was about 2.1 in Japan and about 1.4 in the UK.

Look closer and the dark-time shares are similar: 21.9% in Japan and 24.1% in the UK. The big difference is in daylight, 9.2% in Japan against 15.3% in the UK. In other words, Japan is a country with few pedestrian crashes while it is light, and that advantage disappears once it gets dark.

Why that happens can’t be settled from this data. Possible explanations include Japan having many rear-end collisions between vehicles, which inflates the denominator, or more children and tourists walking around on bright summer evenings in the UK, but I have not checked them. What I can say clearly is that my hypothesis was wrong.

From here on it is pure personal speculation, but perhaps the strength of a cultural normalcy bias is part of it. Many people in Japan move through the evening on “the usual way home at the usual time”. Even when the sky has gone dark, both walkers and drivers head out with the same daytime sense that “it’s the usual, so it’s fine”. That routine supports safety in daylight and backfires the moment it gets dark. I would love to test this if there were a chance and data to measure normalcy bias by country, but sadly there seems to be neither (ha).

Darkness doesn’t just make crashes more likely, it makes them fatal

So far we have looked at how likely crashes are. Finally, how severe are they? The Japanese data label each crash with a light condition such as “day–day” or “night–dusk”, so for pedestrian-vehicle crashes (2022–2025) I calculated the share that killed someone in each category.

Light condition (police definition) Pedestrian-vehicle crashes Fatal share Pedestrians aged 65+
Day–day (daytime outside the periods below) 79,002 1.26% 37.5%
Day–dusk (1 hour before sunset) 8,540 1.30% 30.6%
Night–dusk (1 hour after sunset) 17,419 2.90% 34.2%
Night–night (night outside the periods below) 40,334 4.01% 21.2%
Night–dawn (1 hour before sunrise) 3,684 7.52% 43.7%
Day–dawn (1 hour after sunrise) 3,723 2.04% 35.0%

The hour before sunset (1.30%) is the same as daytime, but the hour after sunset (2.90%) is more than double. At night roads are emptier and cars tend to go faster, and drivers notice pedestrians later, so the same impact is more likely to be deadly. 67% of fatal pedestrian crashes happened at night, far above night’s 40% share of all pedestrian crashes.

The surprise was that the most dangerous time was not dusk but the hour before sunrise. The fatal share was 7.52%, nearly six times daytime. In this hour 44% of the pedestrians hit were 65 or older, which suggests the mix of people walking dark streets, on early-morning walks or delivering newspapers, plays a part. For pedestrians aged 65 and over, 12.7% of crashes in the hour before sunrise were fatal. The numbers are small, but anyone walking a dark road on a winter morning should assume even more than in the evening that drivers may not see them.

Things to keep in mind when reading these numbers

Read the figures above with the following in mind.

  • A crash share is not the same as how dangerous it is for pedestrians. With no traffic volume data, other crashes at the same time and place were used as the yardstick. If darkness also increases vehicle-to-vehicle crashes, the effect on pedestrians may be larger than shown here.
  • Sunset times are calculated. They come from an approximation using each crash’s latitude, longitude and date. Shade from mountains or buildings and the weather (cloud or rain bring darkness earlier) are not taken into account.
  • Japan and the UK count differently. Japan counts crashes (pedestrian vs. vehicle); the UK counts crashes with a pedestrian casualty and, for the clock change, the number of casualties. The two countries are compared only by shares and ratios, never by raw counts.
  • Regional comparisons are noisy even in 30-minute bins. In a region with few crashes such as Fukuoka, a single bin’s value moves a lot from year to year. Read regional comparisons as the pattern over several years combined.
  • This is correlation, not proof of a mechanism. Things that change along with light (temperature, clothing colour, drinking) are not separated out. The UK clock change is a strong comparison because it nearly fixes the season, but holidays and other effects remain.

Think of evening danger as “minutes after sunset”, not “what time it is”

Back to the original question: the rise in pedestrian crashes on winter evenings had more to do with darkness than with rush hour. At the same 17:00 hour, darkness made the pedestrian share 2.4 times higher, and in the Tokyo–Fukuoka comparison and the UK clock change alike, the increase followed sunset rather than the clock. And the jump came not at the moment of sunset but 15–30 minutes later, as twilight ends.

So the rule of thumb “5 p.m. is dangerous” is right in Tokyo and half wrong in Fukuoka. Take the sunset time from the weather forecast and add 30 minutes: from then on it is “night” for pedestrians and drivers alike. If more drivers turn their lights on early and more pedestrians wear reflectors, the cliff in this article’s chart should get a little gentler. Note that the earliest sunset of the year in the Northern Hemisphere comes not on the winter solstice but in early December (in Tokyo, around 16:28 on about 7 December), so the evening is already at its shortest from the start of December, before the solstice.

Data and method

The results by minutes from sunset can be downloaded as the following CSV (UTF-8).

Column Contents
country Japan or UK
minutes_from_sunset Start of the bin in minutes from sunset (15-minute steps; -90 means 90 to 76 minutes before sunset)
accidents Injury crashes on weekdays between 16:30 and 18:29
pedestrian_accidents Of those, crashes involving a pedestrian (pedestrian vs. vehicle in Japan, crashes with a pedestrian casualty in the UK)
pedestrian_share pedestrian_accidents ÷ accidents

The data used are listed below and were downloaded on 1 December 2026.

  • National Police Agency of Japan, “Traffic accident statistics open data” (Japanese), main table for 2022–2025. The per-crash sunset time field was added from the 2022 data, so 2022 onwards was used to allow cross-checking. Terms of use follow the agency’s usage rules (Public Data License 1.0), which allow modification and commercial use with attribution. The tables, charts and CSV in this article were created by the author by processing that data and were not produced by the National Police Agency.
  • UK Department for Transport, “Road Safety Data” (STATS19), collision and casualty files for the latest five years (2021–2025), published under the Open Government Licence v3.0.

The steps were as follows.

  1. For Japan, each crash’s latitude and longitude (degrees, minutes, seconds) were converted to decimal degrees and combined with the date to calculate sunset (Japan Standard Time) with the NOAA approximation. For the UK, sunset was calculated in the same way from the crash location, adding one hour during British Summer Time (last Sunday of March to last Sunday of October).
  2. Weekdays are Monday to Friday excluding public holidays and the days before them in Japan, and Monday to Friday in the UK.
  3. “Crashes involving a pedestrian” are crashes classified as pedestrian vs. vehicle in Japan, and crashes with at least one casualty whose casualty_class is pedestrian in the UK. The UK clock-change comparison counts the number of pedestrian casualties.
  4. Regions were split by prefecture code, and the share in each time bin was divided by that region’s share between 10:00 and 14:59 to make the index.
Code used for the tabulation (Python)
# Crashes and sunset (National Police Agency of Japan open data 2022-2025 x UK DfT STATS19 2021-2025)
import sys, numpy as np, pandas as pd
import matplotlib; matplotlib.use("Agg"); import matplotlib.pyplot as plt
NPA, UK, OUT = sys.argv[1], sys.argv[2], sys.argv[3]
plt.rcParams.update({"font.family": "DejaVu Sans", "font.size": 15})
C1, C2, C3, INK, INK2 = "#257de0", "#f47230", "#00b894", "#191919", "#666666"

def sunset_utc_min(doy, lat, lon):  # NOAA approximation: sunset (with refraction, upper limb) in UTC minutes
    g = 2*np.pi/365*(doy-1)
    eqt = 229.18*(0.000075+0.001868*np.cos(g)-0.032077*np.sin(g)-0.014615*np.cos(2*g)-0.040849*np.sin(2*g))
    dec = (0.006918-0.399912*np.cos(g)+0.070257*np.sin(g)-0.006758*np.cos(2*g)+0.000907*np.sin(2*g)
           -0.002697*np.cos(3*g)+0.00148*np.sin(3*g))
    la = np.radians(lat)
    ha = np.degrees(np.arccos(np.clip(np.cos(np.radians(90.833))/(np.cos(la)*np.cos(dec))-np.tan(la)*np.tan(dec), -1, 1)))
    return 720-4*(lon-ha)-eqt

def dms(s, n):  # NPA latitude/longitude (degrees, minutes, seconds x 1000 concatenated) to decimal degrees
    s = s.astype(str)
    return pd.to_numeric(s.str[:n])+pd.to_numeric(s.str[n:n+2])/60+pd.to_numeric(s.str[n+2:])/1000/3600

# ---- Japan: main table (one row = one injury crash); the column names in the CSV are Japanese
use = {"都道府県コード":"pref","事故内容":"sev","発生日時  年":"y","発生日時  月":"m","発生日時  日":"d",
       "発生日時  時":"h","発生日時  分":"mi","昼夜":"dn","日の入り時刻  時":"ssh","日の入り時刻  分":"ssm",
       "事故類型":"type","年齢(当事者A)":"ageA","年齢(当事者B)":"ageB","当事者種別(当事者A)":"kindA","当事者種別(当事者B)":"kindB","地点 緯度(北緯)":"lat","地点 経度(東経)":"lon","曜日(発生年月日)":"dow","祝日(発生年月日)":"hol"}
jp = pd.concat([pd.read_csv(f"{NPA}/honhyo_{y}.csv", encoding="cp932", dtype=str, usecols=list(use)).rename(columns=use)
                for y in range(2022, 2026)])
for c in ["y","m","d","h","mi","dn","ssh","ssm","pref","sev"]: jp[c] = pd.to_numeric(jp[c])
jp = jp[jp.y.between(2022, 2025)].reset_index(drop=True)
jp["lat"], jp["lon"] = dms(jp.lat, 2), dms(jp.lon, 3)
jp = jp[(jp.lat > 20) & (jp.lon > 120)]
jp["date"] = pd.to_datetime(dict(year=jp.y, month=jp.m, day=jp.d))
jp["t"] = jp.h*60+jp.mi
jp["ss"] = sunset_utc_min(jp.date.dt.dayofyear.values, jp.lat.values, jp.lon.values)+540
jp["rel"] = jp.t-jp.ss
jp["ped"] = jp.type == "01"                                  # pedestrian vs. vehicle
jp["wd"] = jp.dow.isin(["2","3","4","5","6"]) & (jp.hol == "3")  # weekdays (excluding holidays and days before holidays)
chk = (jp.ssh*60+jp.ssm-jp.ss).abs()
print("JP crashes", len(jp), "pedestrian", jp.ped.sum(), "| within 5 min of recorded sunset", round((chk <= 5).mean()*100, 1), "%")

# ---- UK: collision and casualty tables (casualty_class=3 is a pedestrian)
col = pd.read_csv(f"{UK}/dft-road-casualty-statistics-collision-last-5-years.csv", dtype={"collision_index": str}, low_memory=False,
                  usecols=["collision_index","longitude","latitude","date","day_of_week","time"])
cas = pd.read_csv(f"{UK}/dft-road-casualty-statistics-casualty-last-5-years.csv", dtype={"collision_index": str}, low_memory=False,
                  usecols=["collision_index","casualty_class","casualty_severity"])
pc = cas[cas.casualty_class == 3].groupby("collision_index").agg(pn=("casualty_class","size"), ksi=("casualty_severity", lambda s: (s <= 2).sum()))
uk = col.merge(pc, on="collision_index", how="left").fillna({"pn": 0, "ksi": 0}).dropna(subset=["latitude"])
uk["date"] = pd.to_datetime(uk.date, format="%d/%m/%Y")
hm = uk.time.str.split(":", expand=True).astype(int); uk["t"] = hm[0]*60+hm[1]
def last_sunday(y, m):
    d = pd.Timestamp(y, m, 1)+pd.offsets.MonthEnd(0); return d-pd.Timedelta(days=(d.dayofweek+1) % 7)
yrs = range(2021, 2026)
bst = np.zeros(len(uk), bool)
for y in yrs: bst |= (uk.date >= last_sunday(y, 3)) & (uk.date < last_sunday(y, 10))
uk["ss"] = sunset_utc_min(uk.date.dt.dayofyear.values, uk.latitude.values, uk.longitude.values)+np.where(bst, 60, 0)
uk["rel"] = uk.t-uk.ss; uk["ped"] = uk.pn > 0; uk["wd"] = uk.day_of_week.between(2, 6)
print("UK crashes", len(uk), "with pedestrian casualties", uk.ped.sum())

# ---- 1) Same clock time only (weekdays 16:30-18:29): pedestrian share by minutes from sunset
rows = []
for name, d in [("Japan", jp), ("UK", uk)]:
    s = d[d.wd & d.t.between(990, 1109) & d.rel.between(-90, 119)]
    g = s.groupby((s.rel//15*15).astype(int)).agg(accidents=("ped","size"), pedestrian=("ped","sum"))
    g["share"] = g.pedestrian/g.accidents
    for k, r in g.iterrows(): rows.append([name, k, int(r.accidents), int(r.pedestrian), round(r.share, 4)])
    pre, post = s[s.rel.between(-90, -16)], s[s.rel.between(30, 119)]
    print(name, "before sunset (-90 to -16 min)", round(pre.ped.mean()*100, 1), "% -> after (30 to 119 min)", round(post.ped.mean()*100, 1), "% ratio", round(post.ped.mean()/pre.ped.mean(), 2))
curve = pd.DataFrame(rows, columns=["country","minutes_from_sunset","accidents","pedestrian_accidents","pedestrian_share"])
curve.to_csv(f"{OUT}/pedestrian-share-by-minutes-from-sunset.csv", index=False)

# Light vs. dark within the 17:00 hour, and by month
for name, d in [("Japan", jp), ("UK", uk)]:
    s = d[d.wd & d.t.between(1020, 1079)]
    l, k = s[s.rel < -30], s[s.rel >= 30]
    print(name, "weekday 17:00 hour light", len(l), round(l.ped.mean()*100, 1), "% / dark", len(k), round(k.ped.mean()*100, 1), "% ratio", round(k.ped.mean()/l.ped.mean(), 2))
w = jp[jp.wd]; mm = pd.DataFrame({
    "median_sunset": w[w.t.between(1020,1079)].groupby("m").ss.median().map(lambda v: f"{int(v//60)}:{int(v%60):02d}"),
    "ped_share_17h_%": (w[w.t.between(1020,1079)].groupby("m").ped.mean()*100).round(1),
    "ped_share_12_14h_%": (w[w.t.between(720,899)].groupby("m").ped.mean()*100).round(1)})
print(mm.to_string())

# 2) Share of fatal crashes by light condition (pedestrian vs. vehicle)
lab = {11:"day-dawn",12:"day-day",13:"day-dusk (1 h before sunset)",21:"night-dusk (1 h after sunset)",22:"night-night",23:"night-dawn"}
p = jp[jp.ped]
print(p.groupby("dn").agg(crashes=("sev","size"), fatal_pct=("sev", lambda s: round((s == 1).mean()*100, 2))).rename(index=lab))
p = p.assign(old=p.ageB.where(p.kindB == "61", p.ageA.where(p.kindA == "61")).isin(["65", "75"]))  # pedestrian aged 65+
print(p.groupby("dn").agg(aged_65_plus_pct=("old", lambda s: round(s.mean()*100, 1))).rename(index=lab))
print(p.groupby(["dn", "old"]).sev.apply(lambda s: round((s == 1).mean()*100, 2)).unstack().rename(index=lab))
print("night share of fatal pedestrian crashes", round((p[p.sev == 1].dn >= 20).mean()*100, 1), "% / of all pedestrian crashes", round((p.dn >= 20).mean()*100, 1), "%")

# 3) Winter weekdays: Tokyo area, Osaka area and Fukuoka on the same clock (index, midday 10:00-14:59 share = 1)
win = jp[jp.wd & jp.m.isin([11, 12, 1])]
reg = {"Tokyo area": [30,43,44,45], "Osaka area": [61,62,63,64], "Fukuoka": [90]}
idx = {}
for r, codes in reg.items():
    s = win[win.pref.isin(codes)]; base = s[s.t.between(600, 899)].ped.mean()
    e = s[s.t.between(900, 1199)]; g = e.groupby(e.t//30*30).ped.mean()/base
    idx[r] = (g, s.ss.median(), len(s), int(s.ped.sum()))
    print(r, "crashes", len(s), "pedestrian", int(s.ped.sum()), "median sunset", f"{int(s.ss.median()//60)}:{int(s.ss.median()%60):02d}",
          {f"{k//60}:{k%60:02d}": round(v, 2) for k, v in g.items()})

# 4) UK autumn clock change: two weeks before and after (weekdays)
res = []
for y in yrs:
    c = last_sunday(y, 10)
    for wk, (a, b) in {"before": (-14, -1), "after": (1, 14)}.items():
        s = uk[uk.wd & uk.date.between(c+pd.Timedelta(days=a), c+pd.Timedelta(days=b))]
        ev, md = s[s.t.between(960, 1139)], s[s.t.between(600, 899)]
        res.append(dict(y=y, wk=wk, days=s.date.nunique(), eve=int(ev.pn.sum()), mid=int(md.pn.sum()), eve_ksi=int(ev.ksi.sum())))
dst = pd.DataFrame(res); dst["ratio"] = dst.eve/dst.mid
print(dst.round(2).to_string())
t = dst.groupby("wk")[["days","eve","mid","eve_ksi"]].sum(); t["eve_per_day"] = t.eve/t.days; t["mid_per_day"] = t.mid/t.days
print(t.round(2))

# ---- Charts
def finish(ax, src):
    for sp in ["top","right"]: ax.spines[sp].set_visible(False)
    for sp in ["left","bottom"]: ax.spines[sp].set_color("#bbbbbb")
    ax.tick_params(colors=INK2); ax.grid(axis="y", color="#e6e6e6", lw=1); ax.set_axisbelow(True)
    ax.figure.text(0.01, 0.015, src, fontsize=11.5, color=INK2)

fig, ax = plt.subplots(figsize=(16, 9), dpi=100)
for (en, c) in [("Japan", C1), ("UK", C2)]:
    d = curve[curve.country == en]; x = d.minutes_from_sunset+7.5
    ax.plot(x, d.pedestrian_share*100, color=c, lw=3, marker="o", ms=9)
    ax.text(x.iloc[0], d.pedestrian_share.iloc[0]*100+0.9, en, color=INK, fontsize=17, ha="center", fontweight="bold")
ax.axvline(0, color=INK2, lw=1.5, ls="--"); ax.text(2, 5.5, "Sunset", color=INK2, fontsize=15)
ax.axvspan(0, 30, color="#f2f2f2", zorder=0); ax.text(15, 27.2, "Civil twilight\n(~30 min)", color=INK2, fontsize=13, ha="center")
ax.set_xlim(-95, 125); ax.set_ylim(5, 29)
ax.set_xlabel("Minutes from sunset (15-min bins)", color=INK2); ax.set_ylabel("Share of crashes involving a pedestrian (%)", color=INK2)
ax.set_title("Same clock time (weekdays 16:30-18:29): pedestrian share jumps after sunset", loc="left", fontsize=20, color=INK, pad=16)
finish(ax, "Source: National Police Agency of Japan open data (2022-2025), UK DfT STATS19 (2021-2025); sunset computed per crash location (NOAA formula) / Chart: ixam.net")
fig.tight_layout(rect=(0, 0.03, 1, 1)); fig.savefig(f"{OUT}/cover.png"); plt.close(fig)

fig, ax = plt.subplots(figsize=(16, 9), dpi=100)
for (r, (g, ssm, n, npd)), c in zip(idx.items(), [C1, C3, C2]):
    x = g.index+15
    ax.plot(x, g.values, color=c, lw=3, marker="o", ms=9, label=r)
    ax.axvline(ssm, color=c, lw=2, ls="--")
    ax.text(ssm+2, 2.13, f"Sunset {int(ssm//60)}:{int(ssm%60):02d}", color=INK, fontsize=13, rotation=90, va="top")
ax.axhline(1, color=INK2, lw=1)
ax.set_xticks(range(900, 1201, 30)); ax.set_xticklabels([f"{v//60}:{v%60:02d}" for v in range(900, 1201, 30)])
ax.set_ylim(0.4, 2.2); ax.set_xlabel("Clock time (30-min bins)", color=INK2)
ax.set_ylabel("Pedestrian share (index, 10:00-14:59 = 1)", color=INK2)
ax.legend(loc="lower right", frameon=False, fontsize=15)
ax.set_title("Nov-Jan weekdays: the pedestrian share rises in sunset order, east to west", loc="left", fontsize=20, color=INK, pad=16)
finish(ax, "Source: National Police Agency of Japan open data (2022-2025); sunset = median of per-crash values / Chart: ixam.net")
fig.tight_layout(rect=(0, 0.03, 1, 1)); fig.savefig(f"{OUT}/east-west.png"); plt.close(fig)

fig, ax = plt.subplots(figsize=(16, 9), dpi=100)
pv = dst.pivot(index="y", columns="wk", values="ratio")
for i, y in enumerate(pv.index):
    ax.plot([pv.loc[y, "before"], pv.loc[y, "after"]], [i, i], color="#cccccc", lw=4, zorder=1)
    ax.scatter(pv.loc[y, "before"], i, s=200, color=C1, zorder=2, edgecolor="white", lw=2)
    ax.scatter(pv.loc[y, "after"], i, s=200, color=C2, zorder=2, edgecolor="white", lw=2)
    ax.text(pv.loc[y, "after"]+0.02, i, f"{pv.loc[y,'before']:.2f} → {pv.loc[y,'after']:.2f}", va="center", fontsize=14, color=INK)
ax.set_yticks(range(len(pv))); ax.set_yticklabels([str(y) for y in pv.index]); ax.invert_yaxis()
ax.scatter([], [], s=200, color=C1, label="2 weeks before"); ax.scatter([], [], s=200, color=C2, label="2 weeks after")
ax.legend(loc="lower right", frameon=False, fontsize=15); ax.set_xlim(0.7, 1.75); ax.grid(axis="x", color="#e6e6e6");
ax.set_xlabel("Pedestrian casualties 16:00-18:59 / 10:00-14:59 (weekdays)", color=INK2)
ax.set_title("UK, autumn clock change (BST to GMT): evening pedestrian casualties rose in all 5 years", loc="left", fontsize=20, color=INK, pad=16)
finish(ax, "Source: UK Department for Transport, Road Safety Data (STATS19) 2021-2025, Open Government Licence v3.0 / Chart: ixam.net")
ax.grid(axis="y", visible=False)
fig.tight_layout(rect=(0, 0.03, 1, 1)); fig.savefig(f"{OUT}/uk-clock-change.png"); plt.close(fig)

It needs pandas and matplotlib and is run as python3 final.py <folder with the NPA main-table CSVs> <folder with the UK CSVs> <output folder>. Put the NPA main tables honhyo_2022.csv to honhyo_2025.csv, and the UK files dft-road-casualty-statistics-collision-last-5-years.csv and dft-road-casualty-statistics-casualty-last-5-years.csv, in place under their original names.

Frequently asked questions

Do pedestrian crashes rise in the evening because of rush hour or because it gets dark?

Darkness matters more. In Japan’s National Police Agency open data (2022–2025), among weekday crashes in the 17:00 hour, pedestrians were involved in 21.9% when it was dark (30+ minutes after sunset) and 9.2% when it was light (30+ minutes before sunset), 2.4 times higher at the same clock time. Comparing the Tokyo area with Fukuoka on winter weekdays, the pedestrian share started rising first in the Tokyo area, where the sun sets earlier; in Fukuoka, where sunset is 42 minutes later, it stayed at midday levels until 17:30.

How many minutes after sunset do pedestrian crashes increase?

Sorting weekday crashes between 16:30 and 18:29 by minutes from sunset, the pedestrian share in Japan jumps from about 10% to about 20% in the 15–30 minute bin after sunset. In the first 15 minutes it is still 14%; the change comes as civil twilight (about 30 minutes) ends. UK data also show the share rising from 30 minutes after sunset.

How much deadlier are pedestrian crashes at night than during the day?

In Japan’s data (2022–2025, 153,000 pedestrian-vehicle crashes), 1.26% of daytime crashes (excluding the hour around sunrise and sunset) were fatal, compared with 4.01% at night, about three times higher. The highest rate was in the hour before sunrise, at 7.52%, when 44% of pedestrians hit were aged 65 or older. 67% of fatal pedestrian crashes happened at night, far above night’s 40% share of all pedestrian crashes.

Do pedestrian crashes change when daylight saving time ends?

In UK Department for Transport data (STATS19, 2021–2025), comparing weekdays in the two weeks before and after the clocks go back on the last Sunday of October, pedestrian casualties between 16:00 and 18:59 rose from 14.3 to 20.5 per day (+43%). Midday (10:00–14:59) casualties rose only 8% over the same period, and the evening-to-midday ratio went up after the change in all five years. Killed or seriously injured pedestrians nearly doubled, from 193 to 361.