commit 9df6a949a868b8677bcb068e4d9eda7a86fc8ab4 Author: lottopy Date: Sun Jun 12 11:55:02 2022 -0400 initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..2fd9a10 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +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! +# lottopy_web_edition diff --git a/c25_ans.csv b/c25_ans.csv new file mode 100644 index 0000000..f1d7492 --- /dev/null +++ b/c25_ans.csv @@ -0,0 +1,2 @@ +Winning_Numbers,Chance +14-18-2-22-5-9,49/25300 diff --git a/cash25.py b/cash25.py new file mode 100755 index 0000000..f6539c3 --- /dev/null +++ b/cash25.py @@ -0,0 +1,82 @@ +# WVLottopy: Matteo DiBiagio +from fractions import Fraction as frac +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('./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 = frac(total_freq, 177100) # Chance = number call freq / all possible numbers i.e. 11238513 +Winning_Numbers = str("-".join(sorted_nums)) + +#print("Likely numbers are . . . ", sorted_nums, "\n", "With percent chance of winning being", chance[0]*100, "%") +d = dict(((k, eval (k)) for k in ('Winning_Numbers','Chance'))) +h = 'Winning_Numbers', 'Chance' +f = open('c25_ans.csv', 'w', encoding='utf_8') +writer = csv.DictWriter(f, fieldnames=h) +writer.writeheader() +writer.writerow(d) \ No newline at end of file diff --git a/cash25.xlsx b/cash25.xlsx new file mode 100644 index 0000000..46c7b81 Binary files /dev/null and b/cash25.xlsx differ diff --git a/cron.txt b/cron.txt new file mode 100644 index 0000000..36a1a8f --- /dev/null +++ b/cron.txt @@ -0,0 +1,11 @@ + # Powerball +1 23 * * 1,3,6 + +# Mega Mil +0 23 * * 2,5 + +# Lotto America +31 22 * * 3,6 + +# D3, D4, C25 (Every day but sunday 7:00) +0 19 * * 1,2,3,4,5,6 diff --git a/d3_ans.csv b/d3_ans.csv new file mode 100644 index 0000000..e57f1b1 --- /dev/null +++ b/d3_ans.csv @@ -0,0 +1,2 @@ +Winning_Numbers,Chance +0-3-8,33/10000 diff --git a/d4_ans.csv b/d4_ans.csv new file mode 100644 index 0000000..3e7a8cc --- /dev/null +++ b/d4_ans.csv @@ -0,0 +1,2 @@ +Winning_Numbers,Chance +3-5-6-8,537/10000 diff --git a/daily3.py b/daily3.py new file mode 100755 index 0000000..7110d3d --- /dev/null +++ b/daily3.py @@ -0,0 +1,83 @@ +# WVLottopy: Matteo DiBiagio +from fractions import Fraction as frac +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('./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 = frac(total_freq, 10000) # Chance = number call freq / all possible numbers i.e. 11238513 +Winning_Numbers = str("-".join(sorted_nums)) + +#print("Likely numbers are . . . ", sorted_nums, "\n", "With percent chance of winning being", chance[0]*100, "%") + +d = dict(((k, eval (k)) for k in ('Winning_Numbers','Chance'))) +h = 'Winning_Numbers', 'Chance' +f = open('d3_ans.csv', 'w', encoding='utf_8') +writer = csv.DictWriter(f, fieldnames=h) +writer.writeheader() +writer.writerow(d) diff --git a/daily3.xlsx b/daily3.xlsx new file mode 100644 index 0000000..b2d94f4 Binary files /dev/null and b/daily3.xlsx differ diff --git a/daily4.py b/daily4.py new file mode 100755 index 0000000..19a6907 --- /dev/null +++ b/daily4.py @@ -0,0 +1,82 @@ +# WVLottopy: Matteo DiBiagio +from fractions import Fraction as frac +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('./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 = frac(total_freq, 10000) # Chance = number call freq / all possible numbers i.e. 11238513 +Winning_Numbers = str("-".join(sorted_nums)) + +#print("Likely numbers are . . . ", sorted_nums, "\n", "With percent chance of winning being", chance[0]*100, "%") +d = dict(((k, eval (k)) for k in ('Winning_Numbers','Chance'))) +h = 'Winning_Numbers', 'Chance' +f = open('d4_ans.csv', 'w', encoding='utf_8') +writer = csv.DictWriter(f, fieldnames=h) +writer.writeheader() +writer.writerow(d) \ No newline at end of file diff --git a/daily4.xlsx b/daily4.xlsx new file mode 100644 index 0000000..7eb29d2 Binary files /dev/null and b/daily4.xlsx differ diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 0000000..02a1703 Binary files /dev/null and b/dump.rdb differ diff --git a/la_ans.csv b/la_ans.csv new file mode 100644 index 0000000..fc335e1 --- /dev/null +++ b/la_ans.csv @@ -0,0 +1,2 @@ +Winning_Numbers,SB,Chance +1-10-32-49-8,[9],1/265200 diff --git a/lotto.xlsx b/lotto.xlsx new file mode 100644 index 0000000..3fe31a1 Binary files /dev/null and b/lotto.xlsx differ diff --git a/lotto_america.py b/lotto_america.py new file mode 100755 index 0000000..32a8392 --- /dev/null +++ b/lotto_america.py @@ -0,0 +1,84 @@ +# WVLottopy: Matteo DiBiagio +#from django_lottopy.lottopy_site.lottopy.lottopy_web_edition.megamil import Winning_Numbers +from fractions import Fraction as frac +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('./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')) +PBs = 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(PBs).most_common(1) + SB = [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 = frac(total_freq, 25989600) # Chance = number call freq / all possible numbers i.e. 11238513 +Winning_Numbers = str("-".join(sorted_nums)) + +#print("Likely numbers are . . . ", sorted_nums, "SB:", likely_pb, "\n", "With percent chance of winning being", chance[0]*100, "%") +d = dict(((k, eval (k)) for k in ('Winning_Numbers', 'SB', 'Chance'))) +h = 'Winning_Numbers', 'SB', 'Chance' +f = open('la_ans.csv', 'w', encoding='utf_8') +writer = csv.DictWriter(f, fieldnames=h) +writer.writeheader() +writer.writerow(d) + diff --git a/lotto_america.xlsx b/lotto_america.xlsx new file mode 100644 index 0000000..80f5639 Binary files /dev/null and b/lotto_america.xlsx differ diff --git a/lotto_megamil.xlsx b/lotto_megamil.xlsx new file mode 100644 index 0000000..00ce6cd Binary files /dev/null and b/lotto_megamil.xlsx differ diff --git a/lottopy_pb.py b/lottopy_pb.py new file mode 100755 index 0000000..3caa9a5 --- /dev/null +++ b/lottopy_pb.py @@ -0,0 +1,86 @@ +# WVLottopy: Matteo DiBiagio +from fractions import Fraction as frac +from sheet2dict import Worksheet +import pandas as pd +import requests +from collections import Counter +import csv + +def fraction_ratio(i): + return i/sum(i) + +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('./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')) +PBs = 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(PBs).most_common(1) + 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 = frac(total_freq, 292201338) # Chance = number call freq / all possible numbers i.e. 11238513 +Winning_Numbers = str("-".join(sorted_nums)) + +#print("Likely numbers are . . . ", sorted_nums, "PB:", likely_pb, "\n", "With percent chance of winning being", chance[0]*100, "%") + +d = dict(((k, eval (k)) for k in ('Winning_Numbers', 'PB', 'Chance'))) +h = 'Winning_Numbers', 'PB', 'Chance' +f = open('pb_ans.csv', 'w', encoding='utf_8') +writer = csv.DictWriter(f, fieldnames=h) +writer.writeheader() +writer.writerow(d) diff --git a/megamil.py b/megamil.py new file mode 100755 index 0000000..f81c63f --- /dev/null +++ b/megamil.py @@ -0,0 +1,82 @@ +# WVLottopy megamil: Matteo DiBiagio +from fractions import Fraction as frac +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('./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')) +PBs = 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(PBs).most_common(1) + MB = [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 = frac(total_freq, 302575350) # Chance = number call freq / all possible numbers i.e. 11238513 +Winning_Numbers = str("-".join(sorted_nums)) + +#print("Likely numbers are . . . ", sorted_nums, "MB:", likely_pb, "\n", "With percent chance of winning being", chance[0]*100, "%") +d = dict(((k, eval (k)) for k in ('Winning_Numbers', 'MB', 'Chance'))) +h = 'Winning_Numbers', 'MB', 'Chance' +f = open('mm_ans.csv', 'w', encoding='utf_8') +writer = csv.DictWriter(f, fieldnames=h) +writer.writeheader() +writer.writerow(d) diff --git a/mm_ans.csv b/mm_ans.csv new file mode 100644 index 0000000..8f740b6 --- /dev/null +++ b/mm_ans.csv @@ -0,0 +1,2 @@ +Winning_Numbers,MB,Chance +17-3-40-52-7,[24],38/151287675 diff --git a/pb_ans.csv b/pb_ans.csv new file mode 100644 index 0000000..7e37982 --- /dev/null +++ b/pb_ans.csv @@ -0,0 +1,2 @@ +Winning_Numbers,PB,Chance +21-39-59-61-63,[17],50/146100669 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ced451f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +pandas==1.3.5 +requests==2.26.0 +sheet2dict==0.1.1 diff --git a/smartscraper.py b/smartscraper.py new file mode 100755 index 0000000..daad455 --- /dev/null +++ b/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/start.sh b/start.sh new file mode 100755 index 0000000..797d6c7 --- /dev/null +++ b/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