本文整理汇总了Python中table.Table.dump方法的典型用法代码示例。如果您正苦于以下问题:Python Table.dump方法的具体用法?Python Table.dump怎么用?Python Table.dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table.Table
的用法示例。
在下文中一共展示了Table.dump方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print_comparison_results
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import dump [as 别名]
def print_comparison_results(result_files, out_format, lower_is_better):
"""Builds a table of the various gathered results and prints it out.
The table also includes an extra column for deltas and adds entries for
significant changes between the last two provided files.
"""
def entries_for_scores(key, scores):
"""Returns entries for the next row, prepending the category name and
appending any significant changes.
"""
old_score, old_ci = scores[-2]
new_score, new_ci = scores[-1]
entries = ["%.2f +- %.2f" % score for score in scores]
entries.insert(0, key)
if confidence_intervals_overlap(old_score, old_ci, new_score, new_ci):
entries.append("")
else:
change = percent_delta(old_score, new_score)
if is_slower(change, lower_is_better):
change_str = "%.4f%% slower" % (change * 100.0)
entries.append(slower(out_format, change_str))
else:
change_str = "+%.4f%% faster" % (change * 100.0)
entries.append(faster(out_format, change_str))
return entries
categories = transpose_result_data(result_files)
columns = [result.short_name() for result in result_files]
columns.insert(0, "Benchmark")
columns.append("Deltas")
table = Table(columns)
geomean = None
for key in categories:
entries = entries_for_scores(key, [run[1] for run in categories[key]])
if key == 'Geomean':
geomean = entries
geomean[0] = bold(out_format, geomean[0])
else:
table.add_row(entries)
if geomean is not None:
table.add_row(geomean)
table.dump(out_format)
示例2: print_results
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import dump [as 别名]
def print_results(result_files, out_format):
"""Builds a table with the parsed results. Used when there is only one
result file.
"""
categories = transpose_result_data(result_files)
columns = [result.short_name() for result in result_files]
columns.insert(0, "Benchmark")
table = Table(columns)
geomean = None
for key in categories:
scores = [run[1] for run in categories[key]]
entries = ["%.2f +- %.2f" % score for score in scores]
entries.insert(0, key)
if key == 'Geomean':
geomean = entries
else:
table.add_row(entries)
if geomean is not None:
table.add_row(geomean)
table.dump(out_format)