Added historical record analysis

This commit is contained in:
2022-06-29 10:55:46 -04:00
parent 976f90a42c
commit 8e35d88d75
15 changed files with 42 additions and 13 deletions
+5 -1
View File
@@ -5,6 +5,10 @@ import requests
from collections import Counter
def get_data():
# previous records which have since been removed from wvlottery.com's database
df_old = pd.read_excel('./excel_lotto_records/lotto_megamil.xlsx')
salvaged = df_old[['Date', 'Numbers', 'MB']]
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",
@@ -16,7 +20,7 @@ def get_data():
dfs = pd.read_html(r.text)
pd.set_option('display.max_rows', None)
# Specifies no max rows, otherwise only shows 10 records
df = dfs[0]
df = dfs[0].append(salvaged, ignore_index=True)
df2 = df[['Date', 'Numbers', 'MB', 'MP']]
date = list(df2['Date'])
nums = list(df2['Numbers'].astype('str'))