尝试新的算法

main
roger 2 years ago
parent 64317e3c93
commit 64f806cc2e
  1. 22
      demo.py

@ -0,0 +1,22 @@
from blue_forecast import dict_sort, dict_rate
d1 = {"01": 17, "09": 17, "03": 16, "10": 16, "14": 15, "15": 15, "11": 14, "02": 14, "07": 14, "06": 12, "12": 11, "08": 10, "16": 10, "05": 9, "13": 8, "04": 8}
d2 = {"01": 43, "09": 42, "04": 39, "15": 38, "06": 37, "08": 36, "10": 34, "16": 32, "11": 32, "05": 31, "12": 31, "03": 30, "02": 29, "14": 28, "07": 27, "13": 26}
d3 = {"15": 84, "10": 72, "06": 71, "08": 71, "16": 71, "01": 71, "05": 71, "07": 69, "11": 65, "09": 64, "13": 62, "14": 61, "04": 59, "02": 57, "12": 55, "03": 48}
d4 = {"15": 120, "11": 118, "16": 113, "05": 109, "08": 103, "09": 103, "07": 103, "12": 103, "06": 102, "14": 102, "04": 100, "02": 99, "10": 95, "03": 95, "13": 94, "01": 93}
d5 = {"15": 186, "16": 179, "11": 167, "06": 164, "07": 159, "13": 157, "12": 156, "14": 155, "02": 155, "03": 153, "05": 151, "09": 146, "04": 145, "08": 143, "01": 131, "10": 130}
data_list = [d1, d2, d3, d4, d5]
result = {}
for d in data_list:
for k, v in d.items():
if k in result.keys():
result[k] += v
else:
result[k] = v
print("新算法")
for k, v in dict_rate(dict_sort(result, 'val', True)).items():
print(f"{k} - {v}")
Loading…
Cancel
Save