F1-analysis / pages /Pit_Stops.py
tracinginsights's picture
Update pages/Pit_Stops.py
8d9b961
raw
history blame
948 Bytes
import streamlit as st
from repo_directory import PitStops
from repo_directory import button
import datetime
YEAR_SELECTED = st.selectbox(
'Select Year',
(2023, 2022, 2021, 2020, 2019, 2018))
season_events, events_list = PitStops.get_season_events(YEAR_SELECTED)
RACE_SELECTED = st.selectbox(
'Select Race',
events_list)
event_id = PitStops.get_event_id(season_events, RACE_SELECTED)
df = PitStops.get_pitstops(event_id) #dhl pitstops
race_names_df, pit_stops_df, drivers_df = PitStops.load_data()
event_date = PitStops.get_event_date(season_events, RACE_SELECTED)
ergast_pitstops, grandprix = PitStops.get_pitstops_by_date(pit_stops_df,drivers_df,race_names_df,event_date)
df_agg = PitStops.combine_dfs(ergast_pitstops, df)
PitStops.plot_event_ratings(df_agg, grandprix)
PitStops.plot_event_pitstops(df, RACE_SELECTED)
PitStops.plot_full_season_median(YEAR_SELECTED)
PitStops.plot_event_ratings(df_agg, grandprix)