File size: 892 Bytes
c21c63f
 
 
 
c9b035f
87a7677
26e8a7e
c9b035f
 
 
92663aa
c21c63f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a56a47e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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)