Tonight the Minnesota Wild won their game against the Nashville Predators, in a nailbiting finish—we (specifically Dmitry Kulikov, age 31) scored our final goal to end 5-4 with 1.3 seconds left of overtime.
It’s always amazing to me as I get older that a large component of professional sports players are younger than I am. (Though hockey players are somewhat older than I’d imagined: Both goalies are in their mid to late thirties, and the median player is still a few years older than I am.)
The NHL has pretty good information available about their games, so I poked around a bit. (Here’s the (extensive!) data for tonight’s game.)
import requests, datetime
def age(born):
today = datetime.date.today()
return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
roster = requests.get("https://statsapi.web.nhl.com/api/v1/teams/30/roster").json()['roster']
# Retrieve full data on each player
players = []
for player in roster:
players.append(requests.get(f"https://statsapi.web.nhl.com{player['person']['link']}").json()['people'][0])
players.sort(key=lambda p: p['birthDate'], reverse=True)
# Display table by age
print("| Name | Position | DOB | Age |\n|-|-|-|-|")
for p in players:
born = datetime.date.fromisoformat(p['birthDate'])
print(f"| [{p['fullName']}](https://www.nhl.com/player/{p['id']}) | {p['primaryPosition']['name']} | {p['birthDate']} | {age(born)} |")
# Find average player age
average_dob = datetime.date.fromtimestamp(sum([datetime.datetime.combine(datetime.date.fromisoformat(p['birthDate']), datetime.time()).timestamp() for p in players])/len(players))
print(f"Average age: {age(average_dob)}")
# Count players by age
min_age = age(datetime.date.fromisoformat(players[0]['birthDate']))
max_age = age(datetime.date.fromisoformat(players[-1]['birthDate']))
players_by_age = {}
for a in range(min_age, max_age+1):
players_by_age[a] = []
for p in players:
players_by_age[age(datetime.date.fromisoformat(p['birthDate']))].append(p)
for age, players in players_by_age.items():
print(f"{len(players)} players {age} years old")
2021-2022 Minnesota Wild players by age:
The average player is 29 years and one month old; the median player is 28.
Name | Position | DOB | Age1 |
---|---|---|---|
Matt Boldy | Left Wing | 2001-04-05 | 21 |
Connor Dewar | Center | 1999-06-26 | 22 |
Tyson Jost | Center | 1998-03-14 | 24 |
Brandon Duhaime | Right Wing | 1997-05-22 | 24 |
Kirill Kaprizov | Left Wing | 1997-04-26 | 24 |
Jordan Greenway | Left Wing | 1997-02-16 | 25 |
Joel Eriksson Ek | Center | 1997-01-29 | 25 |
Kevin Fiala | Left Wing | 1996-07-22 | 25 |
Jacob Middleton | Defenseman | 1996-01-02 | 26 |
Ryan Hartman | Right Wing | 1994-09-20 | 27 |
Matt Dumba | Defenseman | 1994-07-25 | 27 |
Jonas Brodin | Defenseman | 1993-07-12 | 28 |
Frederick Gaudreau | Center | 1993-05-01 | 28 |
Joseph Cramarossa | Center | 1992-10-26 | 29 |
Nick Bjugstad | Center | 1992-07-17 | 29 |
Jon Merrill | Defenseman | 1992-02-03 | 30 |
Marcus Foligno | Left Wing | 1991-08-10 | 30 |
Nicolas Deslauriers | Left Wing | 1991-02-22 | 31 |
Dmitry Kulikov | Defenseman | 1990-10-29 | 31 |
Jared Spurgeon | Defenseman | 1989-11-29 | 32 |
Mats Zuccarello | Right Wing | 1987-09-01 | 34 |
Jordie Benn | Defenseman | 1987-07-26 | 34 |
Cam Talbot | Goalie | 1987-07-05 | 34 |
Alex Goligoski | Defenseman | 1985-07-30 | 36 |
Marc-Andre Fleury | Goalie | 1984-11-28 | 37 |
-
As of today, April 24, 2022. ↩︎