James McCool
commited on
Commit
·
e00631e
1
Parent(s):
8c9691e
Refactor contest length metric calculations in app.py
Browse files- Simplified the calculation of contest length metrics by directly multiplying the length of the session state 'Contest' dataframe with percentage values, improving code clarity and accuracy.
- This change enhances the reliability of player count metrics and streamlines the data processing workflow.
app.py
CHANGED
@@ -233,10 +233,10 @@ with tab2:
|
|
233 |
players_10per = working_df.head(int(len(working_df) * 0.10))
|
234 |
players_20per = working_df.head(int(len(working_df) * 0.20))
|
235 |
contest_len = len(st.session_state['Contest'])
|
236 |
-
len_1per = len(st.session_state['Contest'])
|
237 |
-
len_5per = len(st.session_state['Contest'])
|
238 |
-
len_10per = len(st.session_state['Contest'])
|
239 |
-
len_20per = len(st.session_state['Contest'])
|
240 |
player_counts = pd.Series(list(contest_players[player_columns].values.flatten())).value_counts()
|
241 |
player_1per_counts = pd.Series(list(players_1per[player_columns].values.flatten())).value_counts()
|
242 |
player_5per_counts = pd.Series(list(players_5per[player_columns].values.flatten())).value_counts()
|
|
|
233 |
players_10per = working_df.head(int(len(working_df) * 0.10))
|
234 |
players_20per = working_df.head(int(len(working_df) * 0.20))
|
235 |
contest_len = len(st.session_state['Contest'])
|
236 |
+
len_1per = len(st.session_state['Contest']) * 0.01
|
237 |
+
len_5per = len(st.session_state['Contest']) * 0.05
|
238 |
+
len_10per = len(st.session_state['Contest']) * 0.10
|
239 |
+
len_20per = len(st.session_state['Contest']) * 0.20
|
240 |
player_counts = pd.Series(list(contest_players[player_columns].values.flatten())).value_counts()
|
241 |
player_1per_counts = pd.Series(list(players_1per[player_columns].values.flatten())).value_counts()
|
242 |
player_5per_counts = pd.Series(list(players_5per[player_columns].values.flatten())).value_counts()
|