Spaces:
Runtime error
Runtime error
James McCool
commited on
Commit
·
94323a4
1
Parent(s):
f290cdf
Refactor app.py to ensure unique player entries across multiple DataFrames. Removed duplicate player entries in nfl_dk_sd_raw, nfl_fd_sd_raw, display_Proj, and display_baselines DataFrames by implementing drop_duplicates method for 'Player'. This enhancement improves data integrity and consistency in player projections.
Browse files
app.py
CHANGED
|
@@ -60,7 +60,6 @@ def init_baselines():
|
|
| 60 |
raw_display = raw_display.loc[raw_display['Median'] > 0]
|
| 61 |
raw_display = raw_display.apply(pd.to_numeric, errors='ignore')
|
| 62 |
nfl_dk_sd_raw = raw_display.sort_values(by='Median', ascending=False)
|
| 63 |
-
nfl_dk_sd_raw = nfl_dk_sd_raw.drop_duplicates(subset=['Player'])
|
| 64 |
|
| 65 |
collection = nfl_db["FD_SD_NFL_ROO"]
|
| 66 |
cursor = collection.find()
|
|
@@ -71,7 +70,6 @@ def init_baselines():
|
|
| 71 |
raw_display = raw_display.loc[raw_display['Median'] > 0]
|
| 72 |
raw_display = raw_display.apply(pd.to_numeric, errors='ignore')
|
| 73 |
nfl_fd_sd_raw = raw_display.sort_values(by='Median', ascending=False)
|
| 74 |
-
nfl_fd_sd_raw = nfl_fd_sd_raw.drop_duplicates(subset=['Player'])
|
| 75 |
try:
|
| 76 |
nba_timestamp = nba_dk_sd_raw['timestamp'].values[0]
|
| 77 |
except:
|
|
@@ -145,7 +143,8 @@ with tab1:
|
|
| 145 |
|
| 146 |
with hold_container:
|
| 147 |
hold_container = st.empty()
|
| 148 |
-
display_Proj = display_Proj
|
|
|
|
| 149 |
if sport_var2 == 'NBA':
|
| 150 |
st.dataframe(display_Proj.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(nba_player_roo_format, precision=2), height=1000, use_container_width = True)
|
| 151 |
elif sport_var2 == 'NFL':
|
|
@@ -245,7 +244,8 @@ with tab2:
|
|
| 245 |
display_baselines = display_baselines.sort_values(by='Median', ascending=False)
|
| 246 |
display_baselines['cpt_lock'] = np.where(display_baselines['Player'].isin(lock_var1), 1, 0)
|
| 247 |
display_baselines['lock'] = np.where(display_baselines['Player'].isin(lock_var2), 1, 0)
|
| 248 |
-
|
|
|
|
| 249 |
st.session_state.display_baselines = display_baselines.copy()
|
| 250 |
st.session_state.export_baselines = export_baselines.copy()
|
| 251 |
|
|
|
|
| 60 |
raw_display = raw_display.loc[raw_display['Median'] > 0]
|
| 61 |
raw_display = raw_display.apply(pd.to_numeric, errors='ignore')
|
| 62 |
nfl_dk_sd_raw = raw_display.sort_values(by='Median', ascending=False)
|
|
|
|
| 63 |
|
| 64 |
collection = nfl_db["FD_SD_NFL_ROO"]
|
| 65 |
cursor = collection.find()
|
|
|
|
| 70 |
raw_display = raw_display.loc[raw_display['Median'] > 0]
|
| 71 |
raw_display = raw_display.apply(pd.to_numeric, errors='ignore')
|
| 72 |
nfl_fd_sd_raw = raw_display.sort_values(by='Median', ascending=False)
|
|
|
|
| 73 |
try:
|
| 74 |
nba_timestamp = nba_dk_sd_raw['timestamp'].values[0]
|
| 75 |
except:
|
|
|
|
| 143 |
|
| 144 |
with hold_container:
|
| 145 |
hold_container = st.empty()
|
| 146 |
+
display_Proj = display_Proj.drop_duplicates(subset=['Player'])
|
| 147 |
+
|
| 148 |
if sport_var2 == 'NBA':
|
| 149 |
st.dataframe(display_Proj.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(nba_player_roo_format, precision=2), height=1000, use_container_width = True)
|
| 150 |
elif sport_var2 == 'NFL':
|
|
|
|
| 244 |
display_baselines = display_baselines.sort_values(by='Median', ascending=False)
|
| 245 |
display_baselines['cpt_lock'] = np.where(display_baselines['Player'].isin(lock_var1), 1, 0)
|
| 246 |
display_baselines['lock'] = np.where(display_baselines['Player'].isin(lock_var2), 1, 0)
|
| 247 |
+
display_baselines = display_baselines.drop_duplicates(subset=['Player'])
|
| 248 |
+
|
| 249 |
st.session_state.display_baselines = display_baselines.copy()
|
| 250 |
st.session_state.export_baselines = export_baselines.copy()
|
| 251 |
|