YFDashboard / src /streamlit_app.py
Jon Solow
Use just first position from eligible positions
e2b52d0
raw
history blame
932 Bytes
import os
import streamlit as st
import pandas as pd
LEAGUE_NAME = "LOFG"
DATA_URL = "../tests/mocks/2023_keepers.csv"
@st.cache_data
def load_data():
data = pd.read_csv(os.path.join(os.path.dirname(__file__), DATA_URL), index_col=0)
# Hack to get position, replace with better position from yahoo api in future
data["position"] = data["eligible_positions"].apply(lambda x: eval(x)[0])
data.columns = data.columns.str.lower()
return data
def get_app():
st.title(f"{LEAGUE_NAME} Keeper Options")
data_load_state = st.text("Loading data...")
data = load_data()
data_load_state.text("Data loaded")
raw_display_columns = [
"player_id",
"name",
"position",
"team_name",
"years_eligible",
"keeper_cost",
"eligible",
]
st.subheader("Raw data")
st.write(data[raw_display_columns])
if __name__ == "__main__":
get_app()