Update main.py

This commit is contained in:
Namhyeon Go 2021-04-04 11:20:54 +09:00 committed by GitHub
parent c35d06ee68
commit 89c76c8d85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@ import pandas as pd
import numpy as np
from geneticalgorithm2 import geneticalgorithm2 as ga
cols = [1, 13, 14, 15, 16, 17, 18, 19] # including bonus number
cols = [1, 13, 14, 15, 16, 17, 18, 19] # included bonus number
df = pd.read_excel('excel.xlsx', skiprows=2, usecols=cols, names=[0, 1, 2, 3, 4, 5, 6, 7])
rows = df.values[:10]
@ -23,7 +23,7 @@ def f(X):
for row in rows:
x = row[0]
N = row[1:]
_N = [make_num(x, n, X[0], X[1], X[2], 1, 45) for n in range(1, 8)] # including bonus number
_N = [make_num(x, n, X[0], X[1], X[2], 1, 45) for n in range(1, 8)] # included bonus number
result = len(list(set(N) & set(_N)))
if result > 5:
score += 100
@ -47,5 +47,5 @@ variable = model.output_dict['variable']
_x = max([row[0] for row in rows]) + 1 # get highest number
print ('Recommended numbers (' + str(_x) + 'th):')
nums = sorted([make_num(_x, n, variable[0], variable[1], variable[2], 1, 45) for n in range(1, 7)])
nums = sorted([make_num(_x, n, variable[0], variable[1], variable[2], 1, 45) for n in range(1, 7)]) # excluded bonus number
print(', '.join(str(x) for x in nums))