excel records are counted now, chance is the real odds of the ticket

This commit is contained in:
2026-09-26 03:00:11 -04:00
parent d26a0970b8
commit dddab2852b
8 changed files with 64 additions and 28 deletions
+13 -6
View File
@@ -6,6 +6,10 @@ from collections import Counter
def get_data():
# Old records from the excel sheets, wvlottery.com took these down but they go back to the early 90s on some games
df_old = pd.read_excel('./excel_lotto_records/daily3.xlsx')
salvaged = df_old[['Date', 'Numbers']]
url = 'https://gateway.loyalty.wvlottery.com/services/jackpot/api/v1/jackpot-results?gameId=9&jackpotStatus=PAYABLE&size=500&sort=externalId,drawDate,desc&page='
header = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36",
@@ -25,7 +29,7 @@ def get_data():
dfs = [pd.DataFrame(web)]
pd.set_option('display.max_rows', None)
# Specifies no max rows, otherwise only shows 10 records
df = dfs[0]
df = pd.concat([dfs[0], salvaged], ignore_index=True)
df2 = df[['Date', 'Numbers']]
date = list(df2['Date'])
nums = list(df2['Numbers'].astype('str'))
@@ -34,11 +38,14 @@ def get_data():
date, nums = get_data()
# Formatting
# Site numbers come split by – and the excel records by - so it splits on both
hyphenfree = []
for x in nums:
hyphenfree.append(x.replace('–',', '))
hyphenfree.append(x.replace('–',', ').replace('-',', '))
splitlist = ", ".join(hyphenfree)
sep = splitlist.split(", ")
# Only keep actual digits, gets rid of any blanks from the excel records
sep = [x for x in sep if x.isdigit() and int(x) <= 9]
for n in range(0, 10):
most_common= Counter(sep).most_common(3)
@@ -46,10 +53,10 @@ for n in range(0, 10):
frequency = [v[-1] for v in most_common]
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
total_freq = sum(frequency)
Chance = frac(total_freq, 15000) # Chance = number call freq / all possible numbers i.e. 1000
# Chance = playing the forecast as a box (any order), 3 different digits can come up 6 ways out of 1000 = 3/500
# playing it straight (exact order) is 1/1000
Chance = frac(6, 1000)
Forecast = str(" - ".join(sorted_nums))
print(f"Likely numbers are . . . {Forecast} \n"
f"With percent chance of winning being {Chance} \n"
f"DISCLAIMER: This set's chance is innacurate due to how many numbers are drawn per day.")
f"With percent chance of winning being {Chance}")