costs[cost].append(row)
return costs
+# For prettier printing, replace short column heading
+# names with full, consistent names.
+# Expected input is a list of column strings
+def column_header_replacement(header):
+ replacement_col = {'cost': 'XO Cost'}
+ new_header = header
+ for shortname in replacement_col.keys():
+ # check if header contains any shortnames
+ if shortname in header:
+ index = header.index(shortname)
+ new_header[index] = replacement_col[shortname]
+ return new_header
def print_table(title, header, areas, sortby):
fname = title.lower().replace(" ", "_")