arre99 commited on
Commit
c49dda4
·
1 Parent(s): 5a43fd3

scripts to scrape and save names and constructors as function of year

Browse files
utils/scripts/ergast_constructor_names.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import fastf1
2
+ import time
3
+ import json
4
+ from pprint import pprint
5
+
6
+ from tqdm.std import tqdm
7
+
8
+ year_team_mapping = {}
9
+
10
+ for year in tqdm(range(2025, 1950, -1)):
11
+ constructor_standings = fastf1.ergast.Ergast().get_constructor_standings(year).content[0]
12
+ year_team_mapping[year] = list(constructor_standings["constructorName"])
13
+ time.sleep(1)
14
+
15
+
16
+ with open("year_driver_mapping.json", "w") as f:
17
+ json.dump(year_team_mapping, f)
utils/scripts/ergast_driver_names.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import fastf1
2
+ import time
3
+ import json
4
+
5
+ from tqdm.std import tqdm
6
+
7
+ year_driver_mapping = {}
8
+
9
+ for year in tqdm(range(2025, 1950, -1)):
10
+ ergast = fastf1.ergast.Ergast()
11
+ driver_standings = ergast.get_driver_standings(year).content[0]
12
+ year_driver_mapping[year] = [f"{first} {last}" for (first,last) in zip(driver_standings["givenName"], driver_standings["familyName"])]
13
+ time.sleep(1)
14
+
15
+ with open("year_driver_mapping.json", "w") as f:
16
+ json.dump(year_driver_mapping, f)