File size: 932 Bytes
86f5e84
7a18dc2
 
 
 
f47916d
 
 
 
7a18dc2
f47916d
86f5e84
e2b52d0
 
7a18dc2
 
 
 
b7f4f75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7a18dc2
 
b7f4f75
 
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
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()