tracinginsights commited on
Commit
a183e4d
1 Parent(s): f6c926c

Update pages/Race_Trace.py

Browse files
Files changed (1) hide show
  1. pages/Race_Trace.py +25 -25
pages/Race_Trace.py CHANGED
@@ -1,36 +1,36 @@
1
- # from repo_directory import button
2
- # import streamlit as st
3
- # from repo_directory import Race_Trace
4
- # import pandas as pd
5
- # import kaggle
6
- # import os
7
 
8
 
9
- # kaggle.api.authenticate()
10
- # kaggle.api.dataset_download_files('jtrotman/formula-1-race-events', path='formula-1-race-events', unzip=True)
11
 
12
 
13
- # Race_Trace.get_latest_ergast()
14
 
15
- # # select year
16
- # race_names_df = pd.read_csv("ergast/races.csv")
17
- # available_years = race_names_df.year.unique().tolist()
18
- # available_years.sort(reverse=True)
19
- # YEAR_SELECTED = st.selectbox(
20
- # 'Select year',
21
- # available_years)
22
 
23
 
24
- # # select race
25
- # available_races = race_names_df[race_names_df.year == YEAR_SELECTED].name.tolist()
26
 
27
 
28
- # RACE_SELECTED = st.selectbox(
29
- # 'Select Race',
30
- # available_races)
31
 
32
- # SELECTED_RACEID = race_names_df[
33
- # (race_names_df.year == YEAR_SELECTED) & (race_names_df.name == RACE_SELECTED)
34
- # ].raceId.values[0]
35
 
36
- # Race_Trace.plot(SELECTED_RACEID, YEAR_SELECTED)
 
1
+ from repo_directory import button
2
+ import streamlit as st
3
+ from repo_directory import Race_Trace
4
+ import pandas as pd
5
+ import kaggle
6
+ import os
7
 
8
 
9
+ kaggle.api.authenticate()
10
+ kaggle.api.dataset_download_files('jtrotman/formula-1-race-events', path='formula-1-race-events', unzip=True)
11
 
12
 
13
+ Race_Trace.get_latest_ergast()
14
 
15
+ # select year
16
+ race_names_df = pd.read_csv("ergast/races.csv")
17
+ available_years = race_names_df.year.unique().tolist()
18
+ available_years.sort(reverse=True)
19
+ YEAR_SELECTED = st.selectbox(
20
+ 'Select year',
21
+ available_years)
22
 
23
 
24
+ # select race
25
+ available_races = race_names_df[race_names_df.year == YEAR_SELECTED].name.tolist()
26
 
27
 
28
+ RACE_SELECTED = st.selectbox(
29
+ 'Select Race',
30
+ available_races)
31
 
32
+ SELECTED_RACEID = race_names_df[
33
+ (race_names_df.year == YEAR_SELECTED) & (race_names_df.name == RACE_SELECTED)
34
+ ].raceId.values[0]
35
 
36
+ Race_Trace.plot(SELECTED_RACEID, YEAR_SELECTED)