James McCool
commited on
Commit
·
c4642dd
1
Parent(s):
7f07fe7
Refine error message and enhance duplication frame metrics in app.py
Browse files- Updated the error message for contest retrieval to clarify the conditions under which no contests are found.
- Improved the duplication frame by calculating percentages for 'uniques', 'under_5', and 'under_10' relative to 'EntryCount', enhancing data analysis and clarity.
app.py
CHANGED
|
@@ -88,7 +88,7 @@ with tab1:
|
|
| 88 |
try:
|
| 89 |
contest_names, curr_info = grab_contest_names(db, sport_select, type_var)
|
| 90 |
except:
|
| 91 |
-
st.error("No contests found for this sport
|
| 92 |
st.stop()
|
| 93 |
|
| 94 |
with date_options:
|
|
@@ -428,7 +428,10 @@ with tab2:
|
|
| 428 |
st.dataframe(st.session_state['general_frame'].style.background_gradient(cmap='RdYlGn', axis=1).format(precision=2), hide_index=True)
|
| 429 |
|
| 430 |
with tab5:
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
|
|
|
|
|
|
|
|
|
| 434 |
st.dataframe(st.session_state['duplication_frame'].style.background_gradient(cmap='RdYlGn_r', axis=1).format(precision=2), hide_index=True)
|
|
|
|
| 88 |
try:
|
| 89 |
contest_names, curr_info = grab_contest_names(db, sport_select, type_var)
|
| 90 |
except:
|
| 91 |
+
st.error("No contests found for this sport and/or game type")
|
| 92 |
st.stop()
|
| 93 |
|
| 94 |
with date_options:
|
|
|
|
| 428 |
st.dataframe(st.session_state['general_frame'].style.background_gradient(cmap='RdYlGn', axis=1).format(precision=2), hide_index=True)
|
| 429 |
|
| 430 |
with tab5:
|
| 431 |
+
dupe_frame = working_df[['BaseName', 'EntryCount', 'dupes', 'uniques', 'under_5', 'under_10']]
|
| 432 |
+
dupe_frame['average_dupes'] = dupe_frame['dupes'].mean()
|
| 433 |
+
dupe_frame['uniques%'] = dupe_frame['uniques'] / dupe_frame['EntryCount']
|
| 434 |
+
dupe_frame['under_5%'] = dupe_frame['under_5'] / dupe_frame['EntryCount']
|
| 435 |
+
dupe_frame['under_10%'] = dupe_frame['under_10'] / dupe_frame['EntryCount']
|
| 436 |
+
st.session_state['duplication_frame'] = dupe_frame[['BaseName', 'EntryCount', 'average_dupes', 'uniques', 'uniques%', 'under_5', 'under_5%', 'under_10', 'under_10%']].drop_duplicates(subset='BaseName', keep='first')
|
| 437 |
st.dataframe(st.session_state['duplication_frame'].style.background_gradient(cmap='RdYlGn_r', axis=1).format(precision=2), hide_index=True)
|