F1-analysis / pages /Average_Race_Pace
tracinginsights's picture
Rename pages/Average_Race_Pace.py to pages/Average_Race_Pace
60a920d
raw
history blame
709 Bytes
# Filter out Safety car/VSC laps
import streamlit as st
from repo_directory import Average_Race_Pace
from repo_directory import button
Average_Race_Pace.get_latest_ergast()
drivers_df, laps_df, race_names_df, results_df, available_years = Average_Race_Pace.load_data()
YEAR_SELECTED = st.selectbox(
'Select Year',
available_years)
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]
Average_Race_Pace.plot(laps_df,SELECTED_RACEID,drivers_df, RACE_SELECTED)