Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
03d7065
1
Parent(s):
6bd6835
Optimize player frequency table generation in tab2
Browse files- Modify DataFrame creation to add salary column after initial setup
- Reorder columns for better readability
- Set player name as index for improved table display
- Apply changes consistently for both Regular and Showdown slate frequency tables
app.py
CHANGED
|
@@ -385,13 +385,15 @@ with tab2:
|
|
| 385 |
# Create a DataFrame with the results
|
| 386 |
summary_df = pd.DataFrame({
|
| 387 |
'Player': value_counts.index,
|
| 388 |
-
'Salary': value_counts.index.map(player_salaries),
|
| 389 |
'Frequency': value_counts.values,
|
| 390 |
'Percentage': percentages.values
|
| 391 |
})
|
| 392 |
|
| 393 |
# Sort by frequency in descending order
|
|
|
|
|
|
|
| 394 |
summary_df = summary_df.sort_values('Frequency', ascending=False)
|
|
|
|
| 395 |
|
| 396 |
# Display the table
|
| 397 |
st.write("Player Frequency Table:")
|
|
@@ -418,13 +420,15 @@ with tab2:
|
|
| 418 |
# Create a DataFrame with the results
|
| 419 |
summary_df = pd.DataFrame({
|
| 420 |
'Player': value_counts.index,
|
| 421 |
-
'Salary': value_counts.index.map(player_salaries),
|
| 422 |
'Frequency': value_counts.values,
|
| 423 |
'Percentage': percentages.values
|
| 424 |
})
|
| 425 |
|
| 426 |
# Sort by frequency in descending order
|
|
|
|
|
|
|
| 427 |
summary_df = summary_df.sort_values('Frequency', ascending=False)
|
|
|
|
| 428 |
|
| 429 |
# Display the table
|
| 430 |
st.write("Seed Frame Frequency Table:")
|
|
|
|
| 385 |
# Create a DataFrame with the results
|
| 386 |
summary_df = pd.DataFrame({
|
| 387 |
'Player': value_counts.index,
|
|
|
|
| 388 |
'Frequency': value_counts.values,
|
| 389 |
'Percentage': percentages.values
|
| 390 |
})
|
| 391 |
|
| 392 |
# Sort by frequency in descending order
|
| 393 |
+
summary_df['Salary'] = summary_df['Player'].map(player_salaries)
|
| 394 |
+
summary_df = summary_df[['Player', 'Salary', 'Frequency', 'Percentage']]
|
| 395 |
summary_df = summary_df.sort_values('Frequency', ascending=False)
|
| 396 |
+
summary_df = summary_df.set_index('Player')
|
| 397 |
|
| 398 |
# Display the table
|
| 399 |
st.write("Player Frequency Table:")
|
|
|
|
| 420 |
# Create a DataFrame with the results
|
| 421 |
summary_df = pd.DataFrame({
|
| 422 |
'Player': value_counts.index,
|
|
|
|
| 423 |
'Frequency': value_counts.values,
|
| 424 |
'Percentage': percentages.values
|
| 425 |
})
|
| 426 |
|
| 427 |
# Sort by frequency in descending order
|
| 428 |
+
summary_df['Salary'] = summary_df['Player'].map(player_salaries)
|
| 429 |
+
summary_df = summary_df[['Player', 'Salary', 'Frequency', 'Percentage']]
|
| 430 |
summary_df = summary_df.sort_values('Frequency', ascending=False)
|
| 431 |
+
summary_df = summary_df.set_index('Player')
|
| 432 |
|
| 433 |
# Display the table
|
| 434 |
st.write("Seed Frame Frequency Table:")
|