Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -701,7 +701,7 @@ with tab2:
|
|
701 |
# # Apply the calculation to the DataFrame
|
702 |
# initial_proj['Own%'] = initial_proj.apply(lambda row: calculate_own(row['Position'], row['Own'], initial_proj.loc[initial_proj['Position'] == row['Position'], 'Own'].mean(), factor_c if row['Position'] == 'C' else factor_other), axis=1)
|
703 |
# initial_proj['Own%'] = initial_proj['Own%'].clip(upper=85)
|
704 |
-
initial_proj['Own'] = initial_proj['Own%'] * (
|
705 |
|
706 |
# Drop unnecessary columns and create the final DataFrame
|
707 |
Overall_Proj = initial_proj[['Player', 'Team', 'Position', 'Median', 'Own', 'Salary']]
|
@@ -710,23 +710,23 @@ with tab2:
|
|
710 |
# Copy only the necessary columns
|
711 |
initial_proj = raw_baselines[['Player', 'Team', 'Position', 'Median', 'Own', 'Salary']]
|
712 |
|
713 |
-
# Define the calculation to be applied
|
714 |
-
def calculate_own(position, own, mean_own, factor, max_own=85):
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
|
719 |
-
# Set the factors based on the contest_var1
|
720 |
-
factor_c, factor_other = {
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
}[contest_var1]
|
725 |
|
726 |
-
# Apply the calculation to the DataFrame
|
727 |
-
initial_proj['Own%'] = initial_proj.apply(lambda row: calculate_own(row['Position'], row['Own'], initial_proj.loc[initial_proj['Position'] == row['Position'], 'Own'].mean(), factor_c if row['Position'] == 'C' else factor_other), axis=1)
|
728 |
-
initial_proj['Own%'] = initial_proj['Own%'].clip(upper=85)
|
729 |
-
initial_proj['Own'] = initial_proj['Own%'] * (
|
730 |
|
731 |
# Drop unnecessary columns and create the final DataFrame
|
732 |
Overall_Proj = initial_proj[['Player', 'Team', 'Position', 'Median', 'Own', 'Salary']]
|
|
|
701 |
# # Apply the calculation to the DataFrame
|
702 |
# initial_proj['Own%'] = initial_proj.apply(lambda row: calculate_own(row['Position'], row['Own'], initial_proj.loc[initial_proj['Position'] == row['Position'], 'Own'].mean(), factor_c if row['Position'] == 'C' else factor_other), axis=1)
|
703 |
# initial_proj['Own%'] = initial_proj['Own%'].clip(upper=85)
|
704 |
+
initial_proj['Own'] = initial_proj['Own%'] * (900 / initial_proj['Own%'].sum())
|
705 |
|
706 |
# Drop unnecessary columns and create the final DataFrame
|
707 |
Overall_Proj = initial_proj[['Player', 'Team', 'Position', 'Median', 'Own', 'Salary']]
|
|
|
710 |
# Copy only the necessary columns
|
711 |
initial_proj = raw_baselines[['Player', 'Team', 'Position', 'Median', 'Own', 'Salary']]
|
712 |
|
713 |
+
# # Define the calculation to be applied
|
714 |
+
# def calculate_own(position, own, mean_own, factor, max_own=85):
|
715 |
+
# return np.where((position == 'C') & (own - mean_own >= 0),
|
716 |
+
# own * (factor * (own - mean_own) / 100) + mean_own,
|
717 |
+
# own)
|
718 |
|
719 |
+
# # Set the factors based on the contest_var1
|
720 |
+
# factor_c, factor_other = {
|
721 |
+
# 'Small': (10, 5),
|
722 |
+
# 'Medium': (6, 3),
|
723 |
+
# 'Large': (3, 1.5),
|
724 |
+
# }[contest_var1]
|
725 |
|
726 |
+
# # Apply the calculation to the DataFrame
|
727 |
+
# initial_proj['Own%'] = initial_proj.apply(lambda row: calculate_own(row['Position'], row['Own'], initial_proj.loc[initial_proj['Position'] == row['Position'], 'Own'].mean(), factor_c if row['Position'] == 'C' else factor_other), axis=1)
|
728 |
+
# initial_proj['Own%'] = initial_proj['Own%'].clip(upper=85)
|
729 |
+
initial_proj['Own'] = initial_proj['Own%'] * (900 / initial_proj['Own%'].sum())
|
730 |
|
731 |
# Drop unnecessary columns and create the final DataFrame
|
732 |
Overall_Proj = initial_proj[['Player', 'Team', 'Position', 'Median', 'Own', 'Salary']]
|