F1-analysis / pages /Lap_Chart.py
tracinginsights's picture
Update pages/Lap_Chart.py
47fabfe
raw
history blame
714 Bytes
import streamlit as st
from repo_directory import Lap_Chart
from repo_directory import button
import pandas as pd
Lap_Chart.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]
Lap_Chart.plot(SELECTED_RACEID, )