James McCool
commited on
Commit
·
5d76637
1
Parent(s):
7d5d8db
Refactor stack size handling in app.py for improved clarity
Browse files- Adjusted the placement of the fillna(1).astype(int) method for the stack_size column to ensure consistent data type handling and enhance clarity in the data processing logic.
app.py
CHANGED
|
@@ -158,8 +158,7 @@ with tab2:
|
|
| 158 |
'own_percent_rank': dict(zip(st.session_state['ownership_df']['Player'], st.session_state['ownership_df']['Own'].rank(pct=True)))
|
| 159 |
}
|
| 160 |
# Create a copy of the dataframe for calculations
|
| 161 |
-
working_df = st.session_state['Contest'].copy()
|
| 162 |
-
working_df['stack_size'] = working_df['stack_size'].fillna(1).astype(int)
|
| 163 |
|
| 164 |
if type_var == 'Classic':
|
| 165 |
working_df['stack'] = working_df.apply(
|
|
@@ -226,7 +225,7 @@ with tab2:
|
|
| 226 |
working_df['percentile_finish'] = working_df['index'].rank(pct=True)
|
| 227 |
working_df['finish'] = working_df['index']
|
| 228 |
working_df = working_df.drop(['sorted', 'index'], axis=1)
|
| 229 |
-
|
| 230 |
st.session_state['field_player_frame'] = create_player_exposures(working_df, player_columns)
|
| 231 |
st.session_state['field_stack_frame'] = create_stack_exposures(working_df)
|
| 232 |
|
|
|
|
| 158 |
'own_percent_rank': dict(zip(st.session_state['ownership_df']['Player'], st.session_state['ownership_df']['Own'].rank(pct=True)))
|
| 159 |
}
|
| 160 |
# Create a copy of the dataframe for calculations
|
| 161 |
+
working_df = st.session_state['Contest'].copy()
|
|
|
|
| 162 |
|
| 163 |
if type_var == 'Classic':
|
| 164 |
working_df['stack'] = working_df.apply(
|
|
|
|
| 225 |
working_df['percentile_finish'] = working_df['index'].rank(pct=True)
|
| 226 |
working_df['finish'] = working_df['index']
|
| 227 |
working_df = working_df.drop(['sorted', 'index'], axis=1)
|
| 228 |
+
working_df['stack_size'] = working_df['stack_size'].fillna(1).astype(int)
|
| 229 |
st.session_state['field_player_frame'] = create_player_exposures(working_df, player_columns)
|
| 230 |
st.session_state['field_stack_frame'] = create_stack_exposures(working_df)
|
| 231 |
|