James McCool
commited on
Commit
·
b67c4a9
1
Parent(s):
664d22a
Update portfolio dataframe condition in app.py for improved null handling
Browse files- Changed the condition for displaying 'portfolio_df' to check for None instead of its presence in session state, enhancing the robustness of data display logic.
- This update aims to prevent potential errors and improve user experience by ensuring that only valid portfolio data is shown.
- app.py +1 -1
- global_func/load_contest_file.py +1 -1
app.py
CHANGED
@@ -216,7 +216,7 @@ with tab1:
|
|
216 |
pass
|
217 |
st.write('Contest data:')
|
218 |
st.dataframe(st.session_state['Contest'].head(25))
|
219 |
-
if 'portfolio_df'
|
220 |
st.write('Portfolio data:')
|
221 |
st.dataframe(st.session_state['portfolio_df'].head(25))
|
222 |
else:
|
|
|
216 |
pass
|
217 |
st.write('Contest data:')
|
218 |
st.dataframe(st.session_state['Contest'].head(25))
|
219 |
+
if 'portfolio_df' is not None:
|
220 |
st.write('Portfolio data:')
|
221 |
st.dataframe(st.session_state['portfolio_df'].head(25))
|
222 |
else:
|
global_func/load_contest_file.py
CHANGED
@@ -167,7 +167,7 @@ def load_contest_file(upload, type, helper = None, sport = None, portfolio = Non
|
|
167 |
portfolio_df['BaseName'] = 'Backtesting_upload'
|
168 |
portfolio_df['EntryCount'] = len(portfolio_df)
|
169 |
original_columns = cleaned_df.columns.tolist()
|
170 |
-
portfolio_df =
|
171 |
cleaned_df = pd.concat([cleaned_df, portfolio_df], ignore_index=True)
|
172 |
|
173 |
# Get unique entry names
|
|
|
167 |
portfolio_df['BaseName'] = 'Backtesting_upload'
|
168 |
portfolio_df['EntryCount'] = len(portfolio_df)
|
169 |
original_columns = cleaned_df.columns.tolist()
|
170 |
+
portfolio_df.columns = original_columns
|
171 |
cleaned_df = pd.concat([cleaned_df, portfolio_df], ignore_index=True)
|
172 |
|
173 |
# Get unique entry names
|