diff --git a/lottopy_site/lottopy/lottopy b/lottopy_site/lottopy/lottopy deleted file mode 160000 index f478a717..00000000 --- a/lottopy_site/lottopy/lottopy +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f478a71775e8d5e79c6e8b1f78fc9cf8de88fee2 diff --git a/lottopy_site/lottopy/lottopy_web_edition/README.md b/lottopy_site/lottopy/lottopy_web_edition/README.md new file mode 100644 index 00000000..15e88370 --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/README.md @@ -0,0 +1,7 @@ +WVLotto.py + +This script generates the five most likely lottery numbers and one powerball, based off frequency pulled. + +This script uses an excel sheet to store the history of all WV Lottery numbers since 1992. It does NOT however guarantee you will win. + +Good luck! diff --git a/lottopy_site/lottopy/lottopy_web_edition/c25_ans.csv b/lottopy_site/lottopy/lottopy_web_edition/c25_ans.csv new file mode 100644 index 00000000..68d8bff2 --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/c25_ans.csv @@ -0,0 +1 @@ +1,16,18,19,20,4,4.611518915866742 diff --git a/lottopy_site/lottopy/lottopy_web_edition/cash25.py b/lottopy_site/lottopy/lottopy_web_edition/cash25.py new file mode 100755 index 00000000..c07c8d81 --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/cash25.py @@ -0,0 +1,77 @@ +# WVLottopy: Matteo DiBiagio +from sheet2dict import Worksheet +import pandas as pd +import requests +from collections import Counter +import csv + +url = 'https://wvlottery.com/draw-games/cash-25/?game-analyze=cash-25&what-to-search=historysearch&date-range=-1' +header = { + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36", + "X-Requested-With": "XMLHttpRequest" +} + +# Get web data +r = requests.get(url, headers=header) +dfs = pd.read_html(r.text) +pd.set_option('display.max_rows', None) +# Specifies no max rows, otherwise only shows 10 records +#print(len(dfs)) +df = dfs[0] +df2 = df[['Date', 'Numbers']] +# Print Table +#print(df2) + +# To excel file +df2.to_excel('../lottopy/cash25.xlsx') + +#Insert complete path to the excel file and index of the worksheet +df = pd.read_excel("cash25.xlsx", sheet_name=0) + +# insert the name of the column as a string in brackets +date = list(df['Date']) +nums = list(df['Numbers'].astype('str')) +#PB = list(df['PB'].astype('int')) +#appearances = list(df2['Winners WV Only'].astype('int')) + +# Index for each row +index = [i for i in range(0,len(nums)*6)] + +# Create an object +ws = Worksheet() + +# Convert active sheet (without specifying sheet name) +ws.xlsx_to_dict(path='cash25.xlsx') + +# Convert sheet of the 'lotto.xslx' spreadsheet file. +ws.xlsx_to_dict(path='cash25.xlsx', select_sheet='Sheet1') + +# object.header returns first row with the data in a spreadsheet, object.sheet_items returns converted rows as dictionaries in the array +#print(ws.header) +#print(ws.sheet_items) + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('-',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 25): + most_common= Counter(sep).most_common(6) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +#for n in range(0, 26): +# most_common_pb = Counter(PB).most_common(1) +# likely_pb = [v[0] for v in most_common_pb] +# frequency_pb = [v[-1] for v in most_common_pb] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency) +chance = [(total_freq / 177100) * 100] # Chance = number call freq / all possible numbers i.e. 11238513 + +#print("Likely numbers are . . . ", sorted_nums, "\n", "With percent chance of winning being", chance[0]*100, "%") +f = open('c25_ans.csv', 'w') +writer = csv.writer(f) +writer.writerow(sorted_nums + chance) \ No newline at end of file diff --git a/lottopy_site/lottopy/lottopy_web_edition/cash25.xlsx b/lottopy_site/lottopy/lottopy_web_edition/cash25.xlsx new file mode 100644 index 00000000..531e9cb5 Binary files /dev/null and b/lottopy_site/lottopy/lottopy_web_edition/cash25.xlsx differ diff --git a/lottopy_site/lottopy/lottopy_web_edition/d3_ans.csv b/lottopy_site/lottopy/lottopy_web_edition/d3_ans.csv new file mode 100644 index 00000000..eee6b547 --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/d3_ans.csv @@ -0,0 +1 @@ +0,8,9,0.29 diff --git a/lottopy_site/lottopy/lottopy_web_edition/d4_ans.csv b/lottopy_site/lottopy/lottopy_web_edition/d4_ans.csv new file mode 100644 index 00000000..bac9ebec --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/d4_ans.csv @@ -0,0 +1 @@ +1,2,3,6,177.96 diff --git a/lottopy_site/lottopy/lottopy_web_edition/daily3.py b/lottopy_site/lottopy/lottopy_web_edition/daily3.py new file mode 100755 index 00000000..6d34d039 --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/daily3.py @@ -0,0 +1,77 @@ +# WVLottopy: Matteo DiBiagio +from sheet2dict import Worksheet +import pandas as pd +import requests +from collections import Counter +import csv + +url = 'https://wvlottery.com/draw-games/daily-3/?game-analyze=daily-3&what-to-search=historysearch&date-range=1' +header = { + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36", + "X-Requested-With": "XMLHttpRequest" +} + +# Get web data +r = requests.get(url, headers=header) +dfs = pd.read_html(r.text) +pd.set_option('display.max_rows', None) +# Specifies no max rows, otherwise only shows 10 records +#print(len(dfs)) +df = dfs[0] +df2 = df[['Date', 'Numbers']] +# Print Table +#print(df2) + +# To excel file +df2.to_excel('../lottopy/daily3.xlsx') + +#Insert complete path to the excel file and index of the worksheet +df = pd.read_excel("daily3.xlsx", sheet_name=0) + +# insert the name of the column as a string in brackets +date = list(df['Date']) +nums = list(df['Numbers'].astype('str')) +#PB = list(df['PB'].astype('int')) +#appearances = list(df2['Winners WV Only'].astype('int')) + +# Index for each row +#index = [i for i in range(0,len(nums)*6)] + +# Create an object +ws = Worksheet() + +# Convert active sheet (without specifying sheet name) +ws.xlsx_to_dict(path='daily3.xlsx') + +# Convert sheet of the 'lotto.xslx' spreadsheet file. +ws.xlsx_to_dict(path='daily3.xlsx', select_sheet='Sheet1') + +# object.header returns first row with the data in a spreadsheet, object.sheet_items returns converted rows as dictionaries in the array +#print(ws.header) +#print(ws.sheet_items) + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('-',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 10): + most_common= Counter(sep).most_common(3) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +#for n in range(0, 26): +# most_common_pb = Counter(PB).most_common(1) +# likely_pb = [v[0] for v in most_common_pb] +# frequency_pb = [v[-1] for v in most_common_pb] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency) +chance = [(total_freq / 10000) * 100] # Chance = number call freq / all possible numbers i.e. 11238513 + +#print("Likely numbers are . . . ", sorted_nums, "\n", "With percent chance of winning being", chance[0]*100, "%") +f = open('d3_ans.csv', 'w') +writer = csv.writer(f) +writer.writerow(sorted_nums + chance) \ No newline at end of file diff --git a/lottopy_site/lottopy/lottopy_web_edition/daily3.xlsx b/lottopy_site/lottopy/lottopy_web_edition/daily3.xlsx new file mode 100644 index 00000000..624be57f Binary files /dev/null and b/lottopy_site/lottopy/lottopy_web_edition/daily3.xlsx differ diff --git a/lottopy_site/lottopy/lottopy_web_edition/daily4.py b/lottopy_site/lottopy/lottopy_web_edition/daily4.py new file mode 100755 index 00000000..06937584 --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/daily4.py @@ -0,0 +1,77 @@ +# WVLottopy: Matteo DiBiagio +from sheet2dict import Worksheet +import pandas as pd +import requests +from collections import Counter +import csv + +url = 'https://wvlottery.com/draw-games/daily-4/?game-analyze=daily-4&what-to-search=historysearch&date-range=-1' +header = { + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36", + "X-Requested-With": "XMLHttpRequest" +} + +# Get web data +r = requests.get(url, headers=header) +dfs = pd.read_html(r.text) +pd.set_option('display.max_rows', None) +# Specifies no max rows, otherwise only shows 10 records +#print(len(dfs)) +df = dfs[0] +df2 = df[['Date', 'Numbers']] +# Print Table +#print(df2) + +# To excel file +df2.to_excel('../lottopy/daily4.xlsx') + +#Insert complete path to the excel file and index of the worksheet +df = pd.read_excel("daily4.xlsx", sheet_name=0) + +# insert the name of the column as a string in brackets +date = list(df['Date']) +nums = list(df['Numbers'].astype('str')) +#PB = list(df['PB'].astype('int')) +#appearances = list(df2['Winners WV Only'].astype('int')) + +# Index for each row +#index = [i for i in range(0,len(nums)*6)] + +# Create an object +ws = Worksheet() + +# Convert active sheet (without specifying sheet name) +ws.xlsx_to_dict(path='daily4.xlsx') + +# Convert sheet of the 'lotto.xslx' spreadsheet file. +ws.xlsx_to_dict(path='daily4.xlsx', select_sheet='Sheet1') + +# object.header returns first row with the data in a spreadsheet, object.sheet_items returns converted rows as dictionaries in the array +#print(ws.header) +#print(ws.sheet_items) + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('-',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 9): + most_common= Counter(sep).most_common(4) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +#for n in range(0, 26): +# most_common_pb = Counter(PB).most_common(1) +# likely_pb = [v[0] for v in most_common_pb] +# frequency_pb = [v[-1] for v in most_common_pb] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency) +chance = [(total_freq / 10000) * 100] # Chance = number call freq / all possible numbers i.e. 11238513 + +#print("Likely numbers are . . . ", sorted_nums, "\n", "With percent chance of winning being", chance[0]*100, "%") +f = open('d4_ans.csv', 'w') +writer = csv.writer(f) +writer.writerow(sorted_nums + chance) \ No newline at end of file diff --git a/lottopy_site/lottopy/lottopy_web_edition/daily4.xlsx b/lottopy_site/lottopy/lottopy_web_edition/daily4.xlsx new file mode 100644 index 00000000..71450445 Binary files /dev/null and b/lottopy_site/lottopy/lottopy_web_edition/daily4.xlsx differ diff --git a/lottopy_site/lottopy/lottopy_web_edition/la_ans.csv b/lottopy_site/lottopy/lottopy_web_edition/la_ans.csv new file mode 100644 index 00000000..bb32cbf3 --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/la_ans.csv @@ -0,0 +1 @@ +1,10,25,34,35,9,0.001204327885000154 diff --git a/lottopy_site/lottopy/lottopy_web_edition/lotto.xlsx b/lottopy_site/lottopy/lottopy_web_edition/lotto.xlsx new file mode 100644 index 00000000..90a9e733 Binary files /dev/null and b/lottopy_site/lottopy/lottopy_web_edition/lotto.xlsx differ diff --git a/lottopy_site/lottopy/lottopy_web_edition/lotto_america.py b/lottopy_site/lottopy/lottopy_web_edition/lotto_america.py new file mode 100755 index 00000000..7d1e1d43 --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/lotto_america.py @@ -0,0 +1,77 @@ +# WVLottopy: Matteo DiBiagio +from sheet2dict import Worksheet +import pandas as pd +import requests +from collections import Counter +import csv + +url = 'https://wvlottery.com/draw-games/lotto-america/?game-analyze=lotto-america&what-to-search=historysearch&date-range=-1' +header = { + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36", + "X-Requested-With": "XMLHttpRequest" +} + +# Get web data +r = requests.get(url, headers=header) +dfs = pd.read_html(r.text) +pd.set_option('display.max_rows', None) +# Specifies no max rows, otherwise only shows 10 records +#print(len(dfs)) +df = dfs[0] +df2 = df[['Date', 'Numbers', 'SB', 'All Star']] +# Print Table +#print(df2) + +# To excel file +df2.to_excel('../lottopy/lotto_america.xlsx') + +#Insert complete path to the excel file and index of the worksheet +df = pd.read_excel("lotto_america.xlsx", sheet_name=0) + +# insert the name of the column as a string in brackets +date = list(df['Date']) +nums = list(df['Numbers'].astype('str')) +PB = list(df['SB'].astype('int')) +#appearances = list(df2['Winners WV Only'].astype('int')) + +# Index for each row +index = [i for i in range(0,len(nums)*6)] + +# Create an object +ws = Worksheet() + +# Convert active sheet (without specifying sheet name) +ws.xlsx_to_dict(path='lotto_america.xlsx') + +# Convert sheet of the 'lotto.xslx' spreadsheet file. +ws.xlsx_to_dict(path='lotto_america.xlsx', select_sheet='Sheet1') + +# object.header returns first row with the data in a spreadsheet, object.sheet_items returns converted rows as dictionaries in the array +#print(ws.header) +#print(ws.sheet_items) + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('-',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 52): + most_common= Counter(sep).most_common(5) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +for n in range(0, 10): + most_common_pb = Counter(PB).most_common(1) + likely_pb = [v[0] for v in most_common_pb] + frequency_pb = [v[-1] for v in most_common_pb] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency + frequency_pb) +chance = [(total_freq / 25989600) * 100] # Chance = number call freq / all possible numbers i.e. 11238513 + +#print("Likely numbers are . . . ", sorted_nums, "SB:", likely_pb, "\n", "With percent chance of winning being", chance[0]*100, "%") +f = open('la_ans.csv', 'w') +writer = csv.writer(f) +writer.writerow(sorted_nums + likely_pb + chance) diff --git a/lottopy_site/lottopy/lottopy_web_edition/lotto_america.xlsx b/lottopy_site/lottopy/lottopy_web_edition/lotto_america.xlsx new file mode 100644 index 00000000..bbd42f41 Binary files /dev/null and b/lottopy_site/lottopy/lottopy_web_edition/lotto_america.xlsx differ diff --git a/lottopy_site/lottopy/lottopy_web_edition/lotto_megamil.xlsx b/lottopy_site/lottopy/lottopy_web_edition/lotto_megamil.xlsx new file mode 100644 index 00000000..e8142d2e Binary files /dev/null and b/lottopy_site/lottopy/lottopy_web_edition/lotto_megamil.xlsx differ diff --git a/lottopy_site/lottopy/lottopy_web_edition/lottopy_pb.py b/lottopy_site/lottopy/lottopy_web_edition/lottopy_pb.py new file mode 100755 index 00000000..3e9eb0c7 --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/lottopy_pb.py @@ -0,0 +1,78 @@ +# WVLottopy: Matteo DiBiagio +from sheet2dict import Worksheet +import pandas as pd +import requests +from collections import Counter +import csv + +url = 'https://wvlottery.com/draw-games/powerball/?game-analyze=powerball&what-to-search=historysearch&date-range=-1' +header = { + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36", + "X-Requested-With": "XMLHttpRequest" +} + +# Get web data +r = requests.get(url, headers=header) +dfs = pd.read_html(r.text) +pd.set_option('display.max_rows', None) +# Specifies no max rows, otherwise only shows 10 records +#print(len(dfs)) +df = dfs[0] +df2 = df[['Date', 'Numbers', 'PB', 'PPX', 'Winners WV Only', 'Payout WV Only']] +# Print Table +#print(df2) + +# To excel file +df2.to_excel('../lottopy/lotto.xlsx') + +#Insert complete path to the excel file and index of the worksheet +df = pd.read_excel("lotto.xlsx", sheet_name=0) + +# insert the name of the column as a string in brackets +date = list(df['Date']) +nums = list(df['Numbers'].astype('str')) +PB = list(df['PB'].astype('int')) +appearances = list(df2['Winners WV Only'].astype('int')) + +# Index for each row +index = [i for i in range(0,len(nums)*6)] + +# Create an object +ws = Worksheet() + +# Convert active sheet (without specifying sheet name) +ws.xlsx_to_dict(path='lotto.xlsx') + +# Convert sheet of the 'lotto.xslx' spreadsheet file. +ws.xlsx_to_dict(path='lotto.xlsx', select_sheet='Sheet1') + +# object.header returns first row with the data in a spreadsheet, object.sheet_items returns converted rows as dictionaries in the array +#print(ws.header) +#print(ws.sheet_items) + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('-',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 69): + most_common= Counter(sep).most_common(5) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +for n in range(0, 26): + most_common_pb = Counter(PB).most_common(1) + likely_pb = [v[0] for v in most_common_pb] + frequency_pb = [v[-1] for v in most_common_pb] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency + frequency_pb) +chance = [(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, "%") + +f = open('pb_ans.csv', 'w') +writer = csv.writer(f) +writer.writerow(sorted_nums + likely_pb + chance) \ No newline at end of file diff --git a/lottopy_site/lottopy/lottopy_web_edition/megamil.py b/lottopy_site/lottopy/lottopy_web_edition/megamil.py new file mode 100755 index 00000000..d5d22d3d --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/megamil.py @@ -0,0 +1,77 @@ +# WVLottopy megamil: Matteo DiBiagio +from sheet2dict import Worksheet +import pandas as pd +import requests +from collections import Counter +import csv + +url = 'https://wvlottery.com/draw-games/mega-millions/?game-analyze=mega-millions&what-to-search=historysearch&date-range=-1' +header = { + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36", + "X-Requested-With": "XMLHttpRequest" +} + +# Get web data +r = requests.get(url, headers=header) +dfs = pd.read_html(r.text) +pd.set_option('display.max_rows', None) +# Specifies no max rows, otherwise only shows 10 records +#print(len(dfs)) +df = dfs[0] +df2 = df[['Date', 'Numbers', 'MB', 'MP']] +# Print Table +#print(df2) + +# To excel file +df2.to_excel('../lottopy/lotto_megamil.xlsx') + +#Insert complete path to the excel file and index of the worksheet +df = pd.read_excel("lotto_megamil.xlsx", sheet_name=0) + +# insert the name of the column as a string in brackets +date = list(df['Date']) +nums = list(df['Numbers'].astype('str')) +PB = list(df['MB'].astype('int')) +#appearances = list(df2['Winners WV Only'].astype('int')) + +# Index for each row +index = [i for i in range(0,len(nums)*6)] + +# Create an object +ws = Worksheet() + +# Convert active sheet (without specifying sheet name) +ws.xlsx_to_dict(path='lotto_megamil.xlsx') + +# Convert sheet of the 'lotto.xslx' spreadsheet file. +ws.xlsx_to_dict(path='lotto_megamil.xlsx', select_sheet='Sheet1') + +# object.header returns first row with the data in a spreadsheet, object.sheet_items returns converted rows as dictionaries in the array +#print(ws.header) +#print(ws.sheet_items) + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('-',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 70): + most_common= Counter(sep).most_common(5) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +for n in range(0, 25): + most_common_pb = Counter(PB).most_common(1) + likely_pb = [v[0] for v in most_common_pb] + frequency_pb = [v[-1] for v in most_common_pb] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency + frequency_pb) +chance = [(total_freq / 302575350) * 100] # Chance = number call freq / all possible numbers i.e. 11238513 + +#print("Likely numbers are . . . ", sorted_nums, "MB:", likely_pb, "\n", "With percent chance of winning being", chance[0]*100, "%") +f = open('mm_ans.csv', 'w') +writer = csv.writer(f) +writer.writerow(sorted_nums + likely_pb + chance) \ No newline at end of file diff --git a/lottopy_site/lottopy/lottopy_web_edition/mm_ans.csv b/lottopy_site/lottopy/lottopy_web_edition/mm_ans.csv new file mode 100644 index 00000000..f2c6eb90 --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/mm_ans.csv @@ -0,0 +1 @@ +10,11,17,20,31,9,0.0002135005379651713 diff --git a/lottopy_site/lottopy/lottopy_web_edition/pb_ans.csv b/lottopy_site/lottopy/lottopy_web_edition/pb_ans.csv new file mode 100644 index 00000000..17f085aa --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/pb_ans.csv @@ -0,0 +1 @@ +23,26,28,32,41,20,0.000539696365113838 diff --git a/lottopy_site/lottopy/lottopy_web_edition/requirements.txt b/lottopy_site/lottopy/lottopy_web_edition/requirements.txt new file mode 100644 index 00000000..ced451fd --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/requirements.txt @@ -0,0 +1,3 @@ +pandas==1.3.5 +requests==2.26.0 +sheet2dict==0.1.1 diff --git a/lottopy_site/lottopy/lottopy_web_edition/smartscraper.py b/lottopy_site/lottopy/lottopy_web_edition/smartscraper.py new file mode 100755 index 00000000..daad4553 --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/smartscraper.py @@ -0,0 +1,73 @@ +# WVLottopy: Matteo DiBiagio +from sheet2dict import Worksheet +import pandas as pd +import requests +from collections import Counter + +url = 'https://wvlottery.com/draw-games/powerball/?game-analyze=powerball&what-to-search=historysearch&date-range=-1' +header = { + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36", + "X-Requested-With": "XMLHttpRequest" +} + +# Get web data +r = requests.get(url, headers=header) +dfs = pd.read_html(r.text) +pd.set_option('display.max_rows', None) +# Specifies no max rows, otherwise only shows 10 records +#print(len(dfs)) +df = dfs[0] +df2 = df[['Date', 'Numbers', 'PB', 'PPX', 'Winners WV Only', 'Payout WV Only']] +# Print Table +#print(df2) + +# To excel file +df2.to_excel('../lottopy/lotto.xlsx') + +#Insert complete path to the excel file and index of the worksheet +df = pd.read_excel("lotto.xlsx", sheet_name=0) + +# insert the name of the column as a string in brackets +date = list(df['Date']) +nums = list(df['Numbers'].astype('str')) +PB = list(df['PB'].astype('int')) +appearances = list(df2['Winners WV Only'].astype('int')) + +# Index for each row +index = [i for i in range(0,len(nums)*6)] + +# Create an object +ws = Worksheet() + +# Convert active sheet (without specifying sheet name) +ws.xlsx_to_dict(path='lotto.xlsx') + +# Convert sheet of the 'lotto.xslx' spreadsheet file. +ws.xlsx_to_dict(path='lotto.xlsx', select_sheet='Sheet1') + +# object.header returns first row with the data in a spreadsheet, object.sheet_items returns converted rows as dictionaries in the array +#print(ws.header) +#print(ws.sheet_items) + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('-',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 69): + most_common= Counter(sep).most_common(5) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +for n in range(0, 26): + most_common_pb = Counter(PB).most_common(1) + likely_pb = [v[0] for v in most_common_pb] + frequency_pb = [v[-1] for v in most_common_pb] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency + frequency_pb) +chance = [(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, "%") diff --git a/lottopy_site/lottopy/lottopy_web_edition/start.sh b/lottopy_site/lottopy/lottopy_web_edition/start.sh new file mode 100755 index 00000000..797d6c7e --- /dev/null +++ b/lottopy_site/lottopy/lottopy_web_edition/start.sh @@ -0,0 +1 @@ +echo "Powerball" && python lottopy_pb.py && echo "MegaMillions" && python megamil.py && echo "Lotto America" && python lotto_america.py && echo "Daily3" && python daily3.py && echo "Daily4" && python daily4.py && echo "Cash25" && python cash25.py diff --git a/lottopy_site/lottopy_site/__pycache__/settings.cpython-310.pyc b/lottopy_site/lottopy_site/__pycache__/settings.cpython-310.pyc index 51a1c445..76010acc 100644 Binary files a/lottopy_site/lottopy_site/__pycache__/settings.cpython-310.pyc and b/lottopy_site/lottopy_site/__pycache__/settings.cpython-310.pyc differ diff --git a/lottopy_site/lottopy_site/settings.py b/lottopy_site/lottopy_site/settings.py index a6c42337..6b948992 100644 --- a/lottopy_site/lottopy_site/settings.py +++ b/lottopy_site/lottopy_site/settings.py @@ -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! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['fresh-fish-51.loca.lt'] # Application definition diff --git a/lottopy_site/static/bootstrap/css/styles.css b/lottopy_site/static/bootstrap/css/styles.css index 76add3b3..879370db 100644 --- a/lottopy_site/static/bootstrap/css/styles.css +++ b/lottopy_site/static/bootstrap/css/styles.css @@ -77,6 +77,7 @@ } body { + padding: 0; margin: 0; font-family: var(--bs-body-font-family); font-size: var(--bs-body-font-size); @@ -88,6 +89,41 @@ body { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } +.box +{ + top: 50%; + left: 50%; + transform: translate(-50%,-50%); + width: 600px; + padding: 20px; + box-sizing: border-box; + border-radius: 4px; + box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5) +} + +.box .svgBox +{ + width: 150px; + flex: 0 0 150px; +} + +.box .svgBox svg +{ + width: 100%; + +} + +.box .content +{ + padding-left: 20px; +} + +.box .content body +{ + margin: 0; + padding-left: 10px 0 0; + text-align: justify; +} hr { margin: 1rem 0; @@ -298,7 +334,7 @@ figure { img, svg { - vertical-align: left; + float: left; } table { @@ -638,6 +674,7 @@ progress { padding-left: var(--bs-gutter-x, 0.75rem); margin-right: auto; margin-left: auto; + position: relative; } @media (min-width: 576px) { @@ -6426,6 +6463,11 @@ textarea.form-control-lg { mask-position: -200% 0%; } } + +.clearfix { + overflow: auto; +} + .clearfix::after { display: block; clear: both; @@ -6664,6 +6706,22 @@ textarea.form-control-lg { float: left !important; } +.float-left { + float: left; + width: 300px; + height: 200px; + background-color: red; + margin: 0 0 0.5rem 0.5rem; +} + +.float-right { + float: right; + width: 300px; + height: 200px; + background-color: red; + margin: 0 0 0.5rem 0.5rem; +} + .float-end { float: right !important; } diff --git a/lottopy_site/templates/lottopy/base.html b/lottopy_site/templates/lottopy/base.html index cb3d1246..c6d6b065 100644 --- a/lottopy_site/templates/lottopy/base.html +++ b/lottopy_site/templates/lottopy/base.html @@ -23,7 +23,7 @@
- + West Virginia Lottery Predictions + + +{% endblock content %} \ No newline at end of file