script progress

This commit is contained in:
matteo-id committed 2022-01-15 15:41:18 -05:00
1 parent 9db090f9c7
commit 200063c4a4
8 files changed
+34 -9

No files matched your search

Binary file not shown.
@@ -1,4 +1,5 @@
# WVLottopy: Matteo DiBiagio # WVLottopy: Matteo DiBiagio
from encodings import utf_8
from sheet2dict import Worksheet from sheet2dict import Worksheet
import pandas as pd import pandas as pd
import requests import requests
@@ -23,7 +24,7 @@ df2 = df[['Date', 'Numbers', 'PB', 'PPX', 'Winners WV Only', 'Payout WV Only']]
#print(df2) #print(df2)
# To excel file # To excel file
df2.to_excel('../lottopy/lotto.xlsx') df2.to_excel('../lottopy_web_edition/lotto.xlsx')
#Insert complete path to the excel file and index of the worksheet #Insert complete path to the excel file and index of the worksheet
df = pd.read_excel("lotto.xlsx", sheet_name=0) df = pd.read_excel("lotto.xlsx", sheet_name=0)
@@ -64,15 +65,18 @@ for n in range(0, 69):
for n in range(0, 26): for n in range(0, 26):
most_common_pb = Counter(PB).most_common(1) most_common_pb = Counter(PB).most_common(1)
likely_pb = [v[0] for v in most_common_pb] likely_pb = str([v[0] for v in most_common_pb])
frequency_pb = [v[-1] for v in most_common_pb] frequency_pb = [v[-1] for v in most_common_pb]
sorted_nums = sorted(likely_nums) sorted_nums = sorted(likely_nums)
final_nums = str("-".join(sorted_nums))
total_freq = sum(frequency + frequency_pb) total_freq = sum(frequency + frequency_pb)
chance = [(total_freq / 292201338) * 100] # Chance = number call freq / all possible numbers i.e. 11238513 chance = str([(total_freq / 292201338) * 100]) # Chance = number call freq / all possible numbers i.e. 11238513
#print("Likely numbers are . . . ", sorted_nums, "PB:", likely_pb, "\n", "With percent chance of winning being", chance[0]*100, "%") #print("Likely numbers are . . . ", sorted_nums, "PB:", likely_pb, "\n", "With percent chance of winning being", chance[0]*100, "%")
f = open('pb_ans.csv', 'w') f = open('pb_ans.csv', 'w', encoding='utf_8')
writer = csv.writer(f) writer = csv.writer(f)
writer.writerow(sorted_nums + likely_pb + chance) writer.writerow([final_nums])
writer.writerow([likely_nums])
writer.writerow([chance])
@@ -1 +1,3 @@
23,26,28,32,41,20,0.000539696365113838 22-23-28-32-41
"['23', '32', '28', '41', '22']"
[0.0005400385948951404]
1 23 22-23-28-32-41 26 28 32 41 20 0.000539696365113838
2 ['23', '32', '28', '41', '22']
3 [0.0005400385948951404]
+21 -2
View File
@@ -1,14 +1,33 @@
# Create your views here. # Create your views here.
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render from django.shortcuts import render
import os
import csv
#f = "~/projects/django_lottopy/lottopy_site/lottopy/lottopy_web_edititon/pb_ans.csv"
#def files(f):
# reader = csv.DictReader(open(f))
# for row in reader:
# global numbers, pb, chance
# numbers = row[0-5]
# pb = row[6]
# chance = row[7]
# pbdata = pbdata(numbers=numbers,pb=pb,chance=chance)
# pbdata.save()
def base(request): def base(request):
return render(request, 'lottopy/base.html', return render(request, 'lottopy/base.html',
{'nbar': 'home'}) {'nbar': 'home'})
def home(request): def home(request):
return render(request, 'lottopy/home.html', module_dir = os.path.dirname(__file__)
{'nbar': 'home'}) file_path = os.path.join(module_dir,'lottopy_web_edition/pb_ans.csv')
pb = csv.reader(file_path)
for row in pb:
numbers = list(pb)
context = {'nbar': 'home', 'numbers': numbers}
return render(request, 'lottopy/home.html', context)
def about(request): def about(request):
return render(request, 'lottopy/about.html', return render(request, 'lottopy/about.html',
+1 -1
View File
@@ -26,7 +26,7 @@ SECRET_KEY = 'django-insecure-p4+um@+npnfqv=mul^--gz@$36@&7^)h@o*72&yqd@n00x$%e&
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
ALLOWED_HOSTS = ['fresh-fish-51.loca.lt'] ALLOWED_HOSTS = ['*']
# Application definition # Application definition