Spaces:
Running
Running
tracinginsights
commited on
Commit
·
c21c63f
1
Parent(s):
e7112bf
Create Race_Trace.py
Browse files- pages/Race_Trace.py +29 -0
pages/Race_Trace.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from repo_directory import button
|
2 |
+
import streamlit as st
|
3 |
+
from repo_directory import Race_Trace
|
4 |
+
import pandas as pd
|
5 |
+
|
6 |
+
Race_Trace.get_latest_ergast()
|
7 |
+
|
8 |
+
# select year
|
9 |
+
race_names_df = pd.read_csv("ergast/races.csv")
|
10 |
+
available_years = race_names_df.year.unique().tolist()
|
11 |
+
available_years.sort(reverse=True)
|
12 |
+
YEAR_SELECTED = st.selectbox(
|
13 |
+
'Select year',
|
14 |
+
available_years)
|
15 |
+
|
16 |
+
|
17 |
+
# select race
|
18 |
+
available_races = race_names_df[race_names_df.year == YEAR_SELECTED].name.tolist()
|
19 |
+
|
20 |
+
|
21 |
+
RACE_SELECTED = st.selectbox(
|
22 |
+
'Select Race',
|
23 |
+
available_races)
|
24 |
+
|
25 |
+
SELECTED_RACEID = race_names_df[
|
26 |
+
(race_names_df.year == YEAR_SELECTED) & (race_names_df.name == RACE_SELECTED)
|
27 |
+
].raceId.values[0]
|
28 |
+
|
29 |
+
Race_Trace.plot(SELECTED_RACEID)
|