DEV Community

Xpect
Xpect

Posted on

Bucketing football goals by minute with pandas: 148 Nations League matches

We keep a match database behind Xpect, a football statistics app, and every international break we pull a quick summary out of it. This time: the 2026/27 Nations League league phase, 148 matches played up to 16 November 2026. Below is a simplified version of the goal-timing step in pandas, and what came out.

The code

Each goal is stored with its minute and stoppage-time offset. Bucketing into 15-minute blocks is a one-liner once stoppage time is folded into its half:

import pandas as pd

goals = pd.read_sql(
    "SELECT match_id, minute, extra FROM goals WHERE competition = 'UEFA Nations League' AND season = '2026/27'",
    conn,
)

# 45+2 belongs to the 31-45 block, 90+4 to the 76-90 block
minute = goals["minute"].clip(upper=90)
bins = [0, 15, 30, 45, 60, 75, 90]
labels = ["1-15", "16-30", "31-45+", "46-60", "61-75", "76-90+"]
goals["block"] = pd.cut(minute, bins=bins, labels=labels, include_lowest=True)

print(goals["block"].value_counts().sort_index())
Enter fullscreen mode Exit fullscreen mode

The result

Block Goals
1-15 47
16-30 65
31-45+ 63
46-60 69
61-75 78
76-90+ 67

389 goals in total, 2.63 per match, the highest league-phase average in five editions of the competition. 55% of goals came after half-time, minutes 61-75 were the busiest, and 15 goals arrived in the 90th minute or later.

Split by division the picture is sharper: League A averaged 3.28 goals per game with only 4 draws in 46 matches, League B 2.21 with 12 draws (eight of them 0-0), League C 2.63, League D 1.58.

Gotchas

  • Stoppage time. If you bucket the raw minute plus extra time, 45+3 lands in the 46-60 block and inflates the second half. Clip first.
  • Own goals count for the team that benefits, so join on the scoring side, not the player's team.
  • Abandoned or forfeited matches need to be excluded before averaging per game.

The summary CSV is on Hugging Face: Nations League 2026/27 league phase stats. Live form, goals and corners per national team are on the Xpect team form cards, and full group tables are in the TohaProBets Nations League tables (Russian).

Statistics only, 18+.

Top comments (1)

Collapse
 
pigskinlab profile image
Pigskin Lab •

Folding stoppage time into its half before bucketing is the part people skip. Does the last bucket (76-90+) lead once the 45+ and 90+ goals are counted, or does it still trail the middle ones?