k1 = {"a_1":111, "a_2":104, "a_3":107, "a_4":90, "a_5":115, "a_6":107, "a_7":106, "a_8":107, "a_9":95, "a_10":116, "a_11":127, "a_12":115, "a_13":102, "a_14":99}
k2 = {"b_1":113, "b_2":107, "b_3":123, "b_4":122, "b_5":117, "b_6":112, "b_7":105, "b_8":108, "b_9":111, "b_10":114, "b_11":102, "b_12":104}
general_row = dict(sorted({**k1, **k2}.items(), key=lambda x: x[1]))
general_row_copy = general_row.copy()
k = 1
for key in general_row_copy:
general_row_copy[key] = k
k += 1
counter = 1
sum_of_rank = 0
listValues=list ( general_row.values() )
uniqValuesDictDup={x:listValues.count(x) for x in listValues
if listValues.count(x)>1}
for i in uniqValuesDictDup:
#ключи исходного словаря [с дублями]
t=[x for x in general_row if general_row[x]==i]
#ключи-порядковые номера-ранги второго словаря
k=[general_row_copy[x] for x in general_row_copy if x in t]
av= sum(k)/len(t)
print (t,k, 'среднее=',av)
for j in t:
general_row_copy[j]=sum(k)/len(t)
for i in sorted(general_row_copy):
print (i, general_row_copy[i], '\r')