James McCool
commited on
Commit
·
e1dafae
1
Parent(s):
1b1d1f9
Update ROI calculation in app.py
Browse files- Modified the calculation of 'Total Payout' to use groupby on 'BaseName', ensuring accurate aggregation of payout data.
- Updated the displayed columns in the ROI frame to include 'Total Fees' and 'Total Payout', enhancing the information available for analysis.fixing ROI calc
app.py
CHANGED
|
@@ -908,9 +908,9 @@ if selected_tab == 'Contest Analysis':
|
|
| 908 |
if 'ROI_frame' not in st.session_state:
|
| 909 |
dupe_frame = st.session_state['display_contest_info'][['BaseName', 'EntryCount', 'finish', 'payout']]
|
| 910 |
dupe_frame['Total Fees'] = dupe_frame['EntryCount'] * st.session_state['entry_fee']
|
| 911 |
-
dupe_frame['Total Payout'] = dupe_frame['payout'].sum()
|
| 912 |
dupe_frame['ROI'] = (dupe_frame['Total Payout'] / dupe_frame['Total Fees'])
|
| 913 |
-
dupe_frame = dupe_frame[['BaseName', 'EntryCount', '
|
| 914 |
st.session_state['ROI_frame'] = dupe_frame.sort_values(by='ROI', ascending=False)
|
| 915 |
if user_ROI_var == 'Specific':
|
| 916 |
st.session_state['ROI_frame'] = st.session_state['ROI_frame'][st.session_state['ROI_frame']['BaseName'].isin(user_ROI_select)]
|
|
|
|
| 908 |
if 'ROI_frame' not in st.session_state:
|
| 909 |
dupe_frame = st.session_state['display_contest_info'][['BaseName', 'EntryCount', 'finish', 'payout']]
|
| 910 |
dupe_frame['Total Fees'] = dupe_frame['EntryCount'] * st.session_state['entry_fee']
|
| 911 |
+
dupe_frame['Total Payout'] = dupe_frame.groupby('BaseName')['payout'].sum()
|
| 912 |
dupe_frame['ROI'] = (dupe_frame['Total Payout'] / dupe_frame['Total Fees'])
|
| 913 |
+
dupe_frame = dupe_frame[['BaseName', 'EntryCount', 'Total Fees', 'Total Payout', 'ROI']].drop_duplicates(subset='BaseName', keep='first')
|
| 914 |
st.session_state['ROI_frame'] = dupe_frame.sort_values(by='ROI', ascending=False)
|
| 915 |
if user_ROI_var == 'Specific':
|
| 916 |
st.session_state['ROI_frame'] = st.session_state['ROI_frame'][st.session_state['ROI_frame']['BaseName'].isin(user_ROI_select)]
|