From dcee2b8d342c8f70b079efa599311021aeb7bcb7 Mon Sep 17 00:00:00 2001 From: chenwj <654891551@qq.com> Date: Sun, 2 Jul 2023 19:06:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8E=92=E5=88=97=E4=BA=94=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lottery/plw.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/lottery/plw.py b/lottery/plw.py index 078e781..fcc9595 100644 --- a/lottery/plw.py +++ b/lottery/plw.py @@ -1,11 +1,30 @@ import numpy as np import pandas as pd -import math +count = 1000 * 100 -a = np.arange(100000) +a = np.arange(count) l = set([ f"{i:05d}" for i in a ]) sum_list = [ sum(map(int, list(i))) for i in l] sum_df = pd.value_counts(sum_list) -print(sum_df.to_dict()) -print(np.ceil((100000/sum_df)).to_dict()) \ No newline at end of file +# print(sum_df.to_dict()) +# print(np.ceil((100000/sum_df)).to_dict()) + +# 数字个数统计 +sum_union_dict = dict() +num_cnt_dict = dict() +for i in a: + item = f"{i:05d}" + sum_first_3 = sum(map(int, list(item[:3]))) + sum_next_3 = sum(map(int, list(item[2:]))) + sum_key = f"{sum_first_3}_{sum_next_3}" + sum_v = sum_union_dict.get(sum_key, 0) + sum_union_dict[sum_key] = sum_v + 1 + num_count = len(set(item)) + v = num_cnt_dict.get(num_count, 0) + num_cnt_dict[num_count] = v + 1 +sum_union_df = pd.Series(sum_union_dict) +num_cnt_df = pd.Series(num_cnt_dict) +print(sum_union_df.sort_values(ascending=False)[:20]) +print(count / num_cnt_df) +print(sum_union_df["14_15"]) \ No newline at end of file