James McCool
commited on
Commit
·
99e552f
1
Parent(s):
62a6685
Add dupe formatting for duplication frame in app.py
Browse files- Introduced a new formatting dictionary for duplicate metrics, enhancing the display of 'uniques%', 'under_5%', and 'under_10%' in the duplication frame.
- Updated the DataFrame formatting to utilize the new dictionary, improving clarity and consistency in data presentation.
app.py
CHANGED
|
@@ -71,6 +71,7 @@ def is_valid_input(file):
|
|
| 71 |
return file is not None # For Streamlit uploader objects
|
| 72 |
|
| 73 |
player_exposure_format = {'Exposure Overall': '{:.2%}', 'Exposure Top 1%': '{:.2%}', 'Exposure Top 5%': '{:.2%}', 'Exposure Top 10%': '{:.2%}', 'Exposure Top 20%': '{:.2%}'}
|
|
|
|
| 74 |
|
| 75 |
tab1, tab2 = st.tabs(["Data Load", "Contest Analysis"])
|
| 76 |
with tab1:
|
|
@@ -187,7 +188,7 @@ with tab2:
|
|
| 187 |
axis=1
|
| 188 |
)
|
| 189 |
working_df['dupes'] = working_df.groupby('sorted').transform('size')
|
| 190 |
-
|
| 191 |
working_df['uniques'] = working_df.groupby('BaseName').apply(
|
| 192 |
lambda x: (x['dupes'] == 1).sum()
|
| 193 |
).reindex(working_df['BaseName']).values
|
|
@@ -450,4 +451,4 @@ with tab2:
|
|
| 450 |
st.dataframe(st.session_state['duplication_frame'].style.
|
| 451 |
background_gradient(cmap='RdYlGn', subset=['uniques%', 'under_5%', 'under_10%'], axis=0).
|
| 452 |
background_gradient(cmap='RdYlGn_r', subset=['uniques', 'under_5', 'under_10'], axis=0).
|
| 453 |
-
format(precision=2), hide_index=True)
|
|
|
|
| 71 |
return file is not None # For Streamlit uploader objects
|
| 72 |
|
| 73 |
player_exposure_format = {'Exposure Overall': '{:.2%}', 'Exposure Top 1%': '{:.2%}', 'Exposure Top 5%': '{:.2%}', 'Exposure Top 10%': '{:.2%}', 'Exposure Top 20%': '{:.2%}'}
|
| 74 |
+
dupe_format = {'uniques%': '{:.2%}', 'under_5%': '{:.2%}', 'under_10%': '{:.2%}'}
|
| 75 |
|
| 76 |
tab1, tab2 = st.tabs(["Data Load", "Contest Analysis"])
|
| 77 |
with tab1:
|
|
|
|
| 188 |
axis=1
|
| 189 |
)
|
| 190 |
working_df['dupes'] = working_df.groupby('sorted').transform('size')
|
| 191 |
+
|
| 192 |
working_df['uniques'] = working_df.groupby('BaseName').apply(
|
| 193 |
lambda x: (x['dupes'] == 1).sum()
|
| 194 |
).reindex(working_df['BaseName']).values
|
|
|
|
| 451 |
st.dataframe(st.session_state['duplication_frame'].style.
|
| 452 |
background_gradient(cmap='RdYlGn', subset=['uniques%', 'under_5%', 'under_10%'], axis=0).
|
| 453 |
background_gradient(cmap='RdYlGn_r', subset=['uniques', 'under_5', 'under_10'], axis=0).
|
| 454 |
+
format(dupe_format, precision=2), hide_index=True)
|