-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.py
49 lines (38 loc) · 1.99 KB
/
dashboard.py
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
38
39
40
41
42
43
44
45
46
47
import sys
import streamlit as st
import pandas as pd
import os
import warnings
warnings.filterwarnings("ignore")
from sidebar import SB_Setup
from main_container import Main_Setup
# Page Setup
st.set_page_config(page_title="F1 ATX 0.0.1", page_icon=":checkered_flag:", layout="wide")
st.title(":checkered_flag: F1 Analytix", anchor=False)
filename = "main.css"
try:
with open(filename) as file:
css = file.read()
st.markdown(f"<style>{css}</style>", unsafe_allow_html=True)
except OSError:
print ("Could not read file:", filename)
st.sidebar.header("F1 ATX")
st.sidebar.subheader("Settings")
# Dataframe setup
driver_df = pd.read_csv("./f1_data/drivers.csv")
ds_df = pd.read_csv("./f1_data/driver_standings.csv")
race_df = pd.read_csv("./f1_data/races.csv")
laps_df = pd.read_csv("./f1_data/lap_times.csv")
c_df = pd.read_csv("./f1_data/circuits.csv")
results_df = pd.read_csv("./f1_data/results.csv")
race_df.rename(columns={"raceId": "race_id", "circuitId": "circuit_id"}, inplace = True)
driver_df.rename(columns={"driverId": "driver_id", "driverRef": "driver_ref"}, inplace = True)
ds_df.rename(columns={"driverStandingsId": "driver_standings_id", "raceId": "race_id", "driverId": "driver_id", "positionText": "postiion_text"}, inplace = True)
laps_df.rename(columns={"raceId": "race_id", "driverId": "driver_id"}, inplace = True)
c_df.rename(columns={"circuitId": "circuit_id", "circuitRef": "circuit_ref"}, inplace = True)
results_df.rename(columns={"resultId": "result_id", "raceId": "race_id", "driverId": "driver_id", "constructorId": "constructor_id", "positionText": "position_text", "positionOrder": "position_order", "fastestLap": "fastest_lap", "fastestLapTime": "fastest_lap_time", "fastestLapSpeed": "fastest_lap_speed", "statusId": "status_id"}, inplace = True)
# Side Bar setup
dfs = {"drivers": driver_df, "driver_standings": ds_df, "races": race_df, "laps": laps_df, "circuits": c_df, "results": results_df}
filters = SB_Setup(dfs)
# Main Container setup
Main_Setup(filters, dfs)