def average_procurement1(): """This function creates a dictionary storing the average awarded amount of each agency.""" global average_procurement string_rep = "Data recorded below indicates the average awarded amount for each agency:" count = 0 signify_end = "------END OF CURRENT DATA------" try: if average_procurement == {}: function_3.procurement_dictionary1() function_3.total_procurement_dictionary1() for row in function_3.total_procurement_dictionary: average_procurement[row] = round( float(function_3.total_procurement_dictionary[row]) / no_companies_agency[row], 2) for rows, value in average_procurement.iteritems(): count += 1 string_rep = string_rep + "\n" + str( count) + " " + rows + ": " + str(value) if count == len(average_procurement): string_rep = string_rep + "\n" + "%050s" % (signify_end) return string_rep else: for rows, value in average_procurement.iteritems(): count += 1 string_rep = string_rep + "\n" + str( count) + " " + rows + ": " + str(value) if count == len(average_procurement): string_rep = string_rep + "\n" + "%050s" % (signify_end) return string_rep except (ValueError, ImportError, IndexError): return "Error with value/import/index file."
def wrapper(): if not data_holder.are_sheets_loaded(): MessageDialog(self, "Load contractors and procurements first!") return function_3.procurement_dictionary1() function_3.total_procurement_dictionary1() self.output_tb.set_output( function_3.sorted_total_procurement_dictionary1(asc))
def wrapper(): if not data_holder.are_sheets_loaded(): MessageDialog(self, "Load contractors and procurements first!") return self.set_output(procurement_dictionary1()) self.set_output(total_procurement_dictionary1()) self.set_output(agency_min_procurement()) self.set_output(sorted_min_procurement(asc))