Update main.py

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

View File

@ -7,8 +7,8 @@ import pandas as pd
import numpy as np
from geneticalgorithm2 import geneticalgorithm2 as ga
cols = [1, 13, 14, 15, 16, 17, 18]
df = pd.read_excel('excel.xlsx', skiprows=2, usecols=cols, names=[0, 1, 2, 3, 4, 5, 6])
cols = [1, 13, 14, 15, 16, 17, 18, 19] # including 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]
def make_num(x, n, a, b, c, min, max):
@ -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, 7)]
_N = [make_num(x, n, X[0], X[1], X[2], 1, 45) for n in range(1, 8)] # including bonus number
result = len(list(set(N) & set(_N)))
if result > 5:
score += 100