def more_often_unit (self): """ """ for each in self.all_content: for el in each['Dozens']: u = utils.ret_unit(int(el)) self.unit['x' + str(u)].append(int(each['Number']))
def more_often_unit (self): """ """ for each in self.all_content: d = 0 for el in each['Dozens']: u = utils.ret_unit(int(el)) if u == 0: self.unit['x0'].append(int(each['Number'])) elif u == 1: self.unit['x1'].append(int(each['Number'])) elif u == 2: self.unit['x2'].append(int(each['Number'])) elif u == 3: self.unit['x3'].append(int(each['Number'])) elif u == 4: self.unit['x4'].append(int(each['Number'])) elif u == 5: self.unit['x5'].append(int(each['Number'])) elif u == 6: self.unit['x6'].append(int(each['Number'])) elif u == 7: self.unit['x7'].append(int(each['Number'])) elif u == 8: self.unit['x8'].append(int(each['Number'])) elif u == 9: self.unit['x9'].append(int(each['Number']))
def suggest_num(self, method='Score', for_print=True): """ """ result = {} st = 'x' for ind, val in enumerate(self.all_stat): num = ind + 1 if num < 10: el = '0' + str(num) else: el = str(num) if method == 'Most Recently': result[el] = val['More']/100 - val['Last']/10 # elif method == 'Least Recently': result[el] = val['More']/100 + val['Last']/10 # elif method == 'Score': result[el] = val['More']/100 - val['Std_Sco']*2 # try: result[el] += val['Freq'][str(val['Last'])] except KeyError: result[el] += 0 doz = utils.dozen(num) result[el] += len(self.doze[str(doz)+st])/1000 #Weight 1/10 uni = utils.ret_unit(num) result[el] += len(self.unit[st+str(uni)])/1000 #Weight 1/10 sorted_list = sorted(result.items(), key=operator.itemgetter(1), reverse=True) if for_print: print('##################### MORE OFTEN #####################') self.prepare_to_print('More') print('################## MORE OFTEN DOZENS #####################') self.print_more_often_dozen() print('################## MORE OFTEN UNITS #####################') self.print_more_often_unit() print('################# SUGGESTED NUMBERS #####################') print(sorted_list) else: return sorted_list