Spaces:
Runtime error
Runtime error
tracinginsights
commited on
Commit
•
d72284a
1
Parent(s):
3a1955d
Create pages/Download_Raw_Data
Browse files- pages/Download_Raw_Data +42 -0
pages/Download_Raw_Data
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from repo_directory import main
|
3 |
+
|
4 |
+
import pandas as pd
|
5 |
+
|
6 |
+
YEAR_SELECTED = st.selectbox(
|
7 |
+
'Select Year',
|
8 |
+
(2023, 2022, 2021, 2020, 2019, 2018))
|
9 |
+
|
10 |
+
RACE_SELECTED = st.selectbox(
|
11 |
+
'Select Race',
|
12 |
+
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23))
|
13 |
+
|
14 |
+
SESSION_SELECTED = st.selectbox(
|
15 |
+
'Select Session',
|
16 |
+
('FP1', 'FP2', 'FP3', 'Q', 'SQ', 'R'))
|
17 |
+
|
18 |
+
laps_with_weather, weather_data, f1session = main.get_laps_with_weather(YEAR_SELECTED, RACE_SELECTED, SESSION_SELECTED)
|
19 |
+
laps_with_weather.to_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv')
|
20 |
+
st.dataframe(pd.read_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv'))
|
21 |
+
with open(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv') as f:
|
22 |
+
st.download_button('Click to Download LapTimes Data', f, file_name=f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv')
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
weather_data.to_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv')
|
28 |
+
st.dataframe(pd.read_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv'))
|
29 |
+
|
30 |
+
with open(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv') as f:
|
31 |
+
st.download_button('Click to Download Weather Data', f, file_name=f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv')
|
32 |
+
|
33 |
+
telemetry = main.get_pos_car_data(f1session)
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
telemetry.to_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv')
|
38 |
+
st.dataframe(pd.read_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv'))
|
39 |
+
|
40 |
+
|
41 |
+
with open(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv') as f:
|
42 |
+
st.download_button('Click to Download Telemetry Data', f, file_name=f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv')
|