Spaces:
Running
Running
Jon Solow
commited on
Commit
Β·
9821e3f
1
Parent(s):
bcf81ec
Move keeper data url to config
Browse files- src/config.py +2 -0
- src/pages/1_Keepers.py +4 -5
src/config.py
CHANGED
@@ -1,3 +1,5 @@
|
|
1 |
LEAGUE_NAME = "LOFG"
|
2 |
DEFAULT_ICON = "π"
|
3 |
LEAGUE_NUMBER_TEAMS = 12
|
|
|
|
|
|
1 |
LEAGUE_NAME = "LOFG"
|
2 |
DEFAULT_ICON = "π"
|
3 |
LEAGUE_NUMBER_TEAMS = 12
|
4 |
+
|
5 |
+
KEEPER_DATA_URL = "../../tests/mocks/2024_keepers.csv"
|
src/pages/1_Keepers.py
CHANGED
@@ -3,14 +3,11 @@ import numpy as np
|
|
3 |
import pandas as pd
|
4 |
import streamlit as st
|
5 |
|
6 |
-
from config import DEFAULT_ICON, LEAGUE_NAME, LEAGUE_NUMBER_TEAMS
|
7 |
from shared_page import common_page_config
|
8 |
from streamlit_filter import filter_dataframe
|
9 |
|
10 |
|
11 |
-
KEEPER_DATA_URL = "../../tests/mocks/2024_keepers.csv"
|
12 |
-
|
13 |
-
|
14 |
def load_player_ids() -> pd.DataFrame:
|
15 |
df = pd.read_csv(r"https://raw.githubusercontent.com/dynastyprocess/data/master/files/db_playerids.csv")
|
16 |
df["merge_id"] = df["yahoo_id"].combine_first(df["stats_id"])
|
@@ -68,7 +65,9 @@ def add_opinionated_keeper_value(df: pd.DataFrame):
|
|
68 |
def load_data():
|
69 |
data = pd.read_csv(os.path.join(os.path.dirname(__file__), KEEPER_DATA_URL), index_col=0)
|
70 |
# Hack to get position, replace with better position from yahoo api in future
|
71 |
-
data["position"] =
|
|
|
|
|
72 |
data.columns = data.columns.str.lower()
|
73 |
data.sort_values(["team_name", "keeper_cost"], inplace=True)
|
74 |
teams_list = sorted(list(data["team_name"].unique()))
|
|
|
3 |
import pandas as pd
|
4 |
import streamlit as st
|
5 |
|
6 |
+
from config import DEFAULT_ICON, LEAGUE_NAME, LEAGUE_NUMBER_TEAMS, KEEPER_DATA_URL
|
7 |
from shared_page import common_page_config
|
8 |
from streamlit_filter import filter_dataframe
|
9 |
|
10 |
|
|
|
|
|
|
|
11 |
def load_player_ids() -> pd.DataFrame:
|
12 |
df = pd.read_csv(r"https://raw.githubusercontent.com/dynastyprocess/data/master/files/db_playerids.csv")
|
13 |
df["merge_id"] = df["yahoo_id"].combine_first(df["stats_id"])
|
|
|
65 |
def load_data():
|
66 |
data = pd.read_csv(os.path.join(os.path.dirname(__file__), KEEPER_DATA_URL), index_col=0)
|
67 |
# Hack to get position, replace with better position from yahoo api in future
|
68 |
+
data["position"] = (
|
69 |
+
data["eligible_positions"].apply(lambda x: x.split(" ")[0]).replace("[", "").replace("]", "").replace("'", "")
|
70 |
+
)
|
71 |
data.columns = data.columns.str.lower()
|
72 |
data.sort_values(["team_name", "keeper_cost"], inplace=True)
|
73 |
teams_list = sorted(list(data["team_name"].unique()))
|