from repo_directory import button import streamlit as st from repo_directory import Race_Trace import pandas as pd import kaggle import os kaggle.api.authenticate() kaggle.api.dataset_download_files('jtrotman/formula-1-race-events', path='formula-1-race-events', unzip=True) Race_Trace.get_latest_ergast() # select year race_names_df = pd.read_csv("ergast/races.csv") available_years = race_names_df.year.unique().tolist() available_years.sort(reverse=True) YEAR_SELECTED = st.selectbox( 'Select year', available_years) # select race available_races = race_names_df[race_names_df.year == YEAR_SELECTED].name.tolist() RACE_SELECTED = st.selectbox( 'Select Race', available_races) SELECTED_RACEID = race_names_df[ (race_names_df.year == YEAR_SELECTED) & (race_names_df.name == RACE_SELECTED) ].raceId.values[0] Race_Trace.plot(SELECTED_RACEID, YEAR_SELECTED)