def agency_max_procurement(): """This function creates a dictionary storing the max awarded procurement amount for each agency""" global max_procurement_dictionary string_rep = "Data recorded below indicates the maximum awrded procurement amount for each agency:" count = 0 signify_end = "------END OF CURRENT DATA------" try: if max_procurement_dictionary == {}: function_3.procurement_dictionary1() for k, v in function_3.procurement_dictionary.iteritems(): combined_string = ",".join( str(number) for number in function_3.procurement_dictionary[k]) store_max = (combined_string).split(",") store_max = [ round(float(elements), 2) for elements in store_max ] max_procurement_dictionary[k] = max(store_max) for rows, value in max_procurement_dictionary.iteritems(): count += 1 string_rep = string_rep + "\n" + str( count) + ") " + rows + ": " + str(value) if count == len(max_procurement_dictionary): string_rep = string_rep + "\n" + "%050s" % (signify_end) return string_rep else: for rows, value in max_procurement_dictionary.iteritems(): count += 1 string_rep = string_rep + "\n" + str( count) + ") " + rows + ": " + str(value) if count == len(max_procurement_dictionary): string_rep = string_rep + "\n" + "%050s" % (signify_end) return string_rep except (ValueError, IndexError, ImportError): return "Error with value/import/index file."
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))