avg_time, which is a average of two
existing fields run1 and run2, is added to each record.
Since all values in a sus file are stored as strings, a conversion to
a number is necessary before using these in arithmetic expressions.
The computed value is formatted in a field of width 6 with only one
digit after the decimal point. This is done using the built-in string
formatting from Python, which is similar to printf in C.
Command:
table2sus < graph.out | sus2sus '--add=avg_time="%6.1f" %
((float(run1)+float(run2))/2)' > avgrun.sus
avgrun.sus
{'labels': ['vertices', 'edges', 'run1', 'run2', 'avg_time'],
'table': [{'vertices': '10', 'avg_time': ' 132.4', 'run2': '141.3',
'edges': '20', 'run1': '123.6'},
{'vertices': '20', 'avg_time': '1582.2', 'run2': '842.9', 'edges':
'80', 'run1': '2321.4'},
{'vertices': '10', 'avg_time': ' 632.4', 'run2': '832.0', 'edges':
'40', 'run1': '432.8'},
{'vertices': '20', 'avg_time': ' 628.6', 'run2': '314.2', 'edges':
'40', 'run1': '943.1'}]}