init
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
from constants import PLAYER_NAME_COLUMNS
|
||||
|
||||
|
||||
def generate_player_table(df):
|
||||
header = [["Name", "Appearances", "Spent"]]
|
||||
|
||||
player_stats = [
|
||||
(name, df[name].sum())
|
||||
for name in df.columns
|
||||
if name in PLAYER_NAME_COLUMNS
|
||||
]
|
||||
player_stats.sort(key=lambda x: x[1], reverse=True)
|
||||
total = sum(n for name, n in player_stats)
|
||||
body = [
|
||||
[name, n, f"£{n * 3:.2f}"]
|
||||
for name, n in player_stats
|
||||
]
|
||||
footer = [["Total", total, f"£{total * 3:.2f}"]]
|
||||
|
||||
return (header + body + footer)
|
||||
Reference in New Issue
Block a user