Spaces:
Sleeping
Sleeping
Jon Solow
commited on
Commit
·
76225a1
1
Parent(s):
f5c14f1
Convert ecr values to rounds
Browse files- src/pages/1_Keepers.py +12 -5
src/pages/1_Keepers.py
CHANGED
@@ -21,9 +21,16 @@ def load_adp() -> pd.DataFrame:
|
|
21 |
return df
|
22 |
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
def add_opinionated_keeper_value(df: pd.DataFrame):
|
25 |
for score_fmt in ["1qb", "2qb"]:
|
26 |
-
df[f"
|
|
|
|
|
27 |
|
28 |
|
29 |
@st.cache_data(ttl=60 * 60 * 24)
|
@@ -107,16 +114,16 @@ def filtered_keeper_dataframe(data: pd.DataFrame, teams_list: list[str]):
|
|
107 |
help="Number of further consecutive seasons player can be kept (subject to maximum of 2)",
|
108 |
),
|
109 |
"ecr_1qb": st.column_config.NumberColumn(
|
110 |
-
label="ECR 1QB", help="Player's average Expert Consensus Rank (ECR) for 1 QB League"
|
111 |
),
|
112 |
"value_1qb": st.column_config.NumberColumn(
|
113 |
-
label="Value 1QB", help="Approx. number of draft
|
114 |
),
|
115 |
"ecr_2qb": st.column_config.NumberColumn(
|
116 |
-
label="ECR 2QB", help="Player's average Expert Consensus Rank (ECR) for 2 QB League"
|
117 |
),
|
118 |
"value_2qb": st.column_config.NumberColumn(
|
119 |
-
label="Value 2QB", help="Approx. number of draft
|
120 |
),
|
121 |
"ecr_pos": st.column_config.NumberColumn(
|
122 |
label="ECR Position", help="Player's average Expert Consensus Rank (ECR) at the player's position"
|
|
|
21 |
return df
|
22 |
|
23 |
|
24 |
+
def convert_ecr_to_round_val(ecr_float: float) -> float:
|
25 |
+
# As a float, store pick 1 of round 1 as 1.0
|
26 |
+
return 1.0 + (ecr_float - 1.0) / LEAGUE_NUMBER_TEAMS
|
27 |
+
|
28 |
+
|
29 |
def add_opinionated_keeper_value(df: pd.DataFrame):
|
30 |
for score_fmt in ["1qb", "2qb"]:
|
31 |
+
df[f"ecr_{score_fmt}"] = df[f"ecr_{score_fmt}"].apply(convert_ecr_to_round_val)
|
32 |
+
# assumes midround keeper
|
33 |
+
df[f"value_{score_fmt}"] = df["keeper_cost"] + 0.5 - df[f"ecr_{score_fmt}"]
|
34 |
|
35 |
|
36 |
@st.cache_data(ttl=60 * 60 * 24)
|
|
|
114 |
help="Number of further consecutive seasons player can be kept (subject to maximum of 2)",
|
115 |
),
|
116 |
"ecr_1qb": st.column_config.NumberColumn(
|
117 |
+
label="ECR 1QB", help="Player's average draft round.pick Expert Consensus Rank (ECR) for 1 QB League"
|
118 |
),
|
119 |
"value_1qb": st.column_config.NumberColumn(
|
120 |
+
label="Value 1QB", help="Approx. number of draft rounds of keeper value vs ECR 1QB"
|
121 |
),
|
122 |
"ecr_2qb": st.column_config.NumberColumn(
|
123 |
+
label="ECR 2QB", help="Player's average draft round.pick Expert Consensus Rank (ECR) for 2 QB League"
|
124 |
),
|
125 |
"value_2qb": st.column_config.NumberColumn(
|
126 |
+
label="Value 2QB", help="Approx. number of draft rounds of keeper value vs ECR 2QB"
|
127 |
),
|
128 |
"ecr_pos": st.column_config.NumberColumn(
|
129 |
label="ECR Position", help="Player's average Expert Consensus Rank (ECR) at the player's position"
|