def updateResults(filename, initial, timeScore):
""" Filename (tihout extension). open the filename.hdf and store results.
then write the results to a HTML file
"""
hdfFile = filename+'.hdf'
if not os.path.exists(hdfFile):
copyfile('./data/default.hdf', hdfFile)
data = pd.read_hdf(hdfFile).reset_index()
# add new entry to data frame
data.loc[len(data)] = [initial, timeScore]
# rank best unique user scores
sortData = data.groupby(['INITIALS']).min().head(10)
# save new data
sortData.to_hdf(hdfFile, 'test', mode='w')
sortData = sortData.sort_values(by='TIME',ascending=True).reset_index()
htmlTable(sortData, filename+'.html')
评论列表
文章目录