James McCool
commited on
Commit
·
fa28f02
1
Parent(s):
02107a7
Refine dataframe display and column name replacement in app.py and create_general_exposures function
Browse files- Streamlined the dataframe display code in app.py by consolidating the background gradient and formatting methods for improved readability.
- Updated the column name replacement logic in create_general_exposures to target the 'Stat' column, enhancing clarity in the displayed data.
- app.py +3 -8
- global_func/create_general_exposures.py +1 -1
app.py
CHANGED
|
@@ -292,14 +292,9 @@ with tab2:
|
|
| 292 |
|
| 293 |
if entry_parse_var == 'All':
|
| 294 |
st.session_state['general_frame'] = create_general_exposures(working_df)
|
| 295 |
-
st.dataframe(st.session_state['general_frame'].
|
| 296 |
-
|
| 297 |
-
format(precision=2),
|
| 298 |
-
hide_index=True)
|
| 299 |
else:
|
| 300 |
st.session_state['general_frame'] = create_general_exposures(working_df, entry_names)
|
| 301 |
-
st.dataframe(st.session_state['general_frame'].
|
| 302 |
-
style.background_gradient(cmap='RdYlGn', axis=1).
|
| 303 |
-
format(precision=2),
|
| 304 |
-
hide_index=True)
|
| 305 |
|
|
|
|
| 292 |
|
| 293 |
if entry_parse_var == 'All':
|
| 294 |
st.session_state['general_frame'] = create_general_exposures(working_df)
|
| 295 |
+
st.dataframe(st.session_state['general_frame'].style.background_gradient(cmap='RdYlGn', axis=1).format(precision=2), hide_index=True)
|
| 296 |
+
|
|
|
|
|
|
|
| 297 |
else:
|
| 298 |
st.session_state['general_frame'] = create_general_exposures(working_df, entry_names)
|
| 299 |
+
st.dataframe(st.session_state['general_frame'].style.background_gradient(cmap='RdYlGn', axis=1).format(precision=2), hide_index=True)
|
|
|
|
|
|
|
|
|
|
| 300 |
|
global_func/create_general_exposures.py
CHANGED
|
@@ -36,5 +36,5 @@ def create_general_exposures(df: pd.DataFrame, entrants: list = None):
|
|
| 36 |
general_exposures = general_row
|
| 37 |
else:
|
| 38 |
general_exposures = pd.concat([general_exposures, general_frame], ignore_index = True, axis = 0)
|
| 39 |
-
general_exposures = general_exposures.replace(['salary', 'actual_fpts', 'actual_own', 'dupes'], ['Salary Used', 'Finishing Points', 'Total Ownership', 'Duplications'])
|
| 40 |
return general_exposures
|
|
|
|
| 36 |
general_exposures = general_row
|
| 37 |
else:
|
| 38 |
general_exposures = pd.concat([general_exposures, general_frame], ignore_index = True, axis = 0)
|
| 39 |
+
general_exposures['Stat'] = general_exposures['Stat'].replace(['salary', 'actual_fpts', 'actual_own', 'dupes'], ['Salary Used', 'Finishing Points', 'Total Ownership', 'Duplications'])
|
| 40 |
return general_exposures
|