-
Notifications
You must be signed in to change notification settings - Fork 3
/
gen_leaderboard.py
27 lines (24 loc) · 971 Bytes
/
gen_leaderboard.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import pandas as pd
df = pd.read_csv('board.csv')
print(len(df))
print(df.head())
# read the title of dataFrame
header = df.columns.values.tolist()
print(header)
with open('test.html', 'w') as f:
for i in range(len(df)):
print(df[header[0]][i])
print(df[header[1]][i])
print(df[header[2]][i])
print(df[header[3]][i])
print(df[header[4]][i])
print(df[header[5]][i])
f.writelines('<tr>\n')
f.writelines('<td align="center">{}</td>\n'.format(df[header[0]][i]))
f.writelines('<td align="center">{}</td>\n'.format(df[header[1]][i]))
f.writelines('<td align="center">{}</td>\n'.format(df[header[2]][i]))
f.writelines('<td align="center">{}</td>\n'.format(df[header[3]][i]))
f.writelines('<td align="center">{}%</td>\n'.format(round(df[header[4]][i], 2)))
f.writelines('<td align="center">{}</td>\n'.format(df[header[5]][i]))
f.writelines('</tr>\n')