Keep a growing record of every draw in the excel sheets
- records.py: merge new draws into each sheet instead of replacing it, so history older than what the WV lottery site keeps is not lost. Cash Pop rows are matched by draw id (several draws a day share Date+Numbers). - All scrapers use records.draw_day() for the draw date and merge_save() for the sheet; cash pop now keeps its own cash_pop.xlsx. - Sheets updated with the latest draws, including the backfilled 10/10 Powerball and Lotto America draws. - Ignore __pycache__, cron logs, sheet lock files and server-side backups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f52dd964ad
commit
a8698c88d3
16 files changed
+153
-13
No files matched your search
@@ -1,6 +1,7 @@
|
||||
# WVLottopy: Matteo DiBiagio
|
||||
from fractions import Fraction as frac
|
||||
import pandas as pd
|
||||
import records
|
||||
import requests
|
||||
from collections import Counter
|
||||
import csv
|
||||
@@ -21,7 +22,7 @@ def get_data():
|
||||
r = requests.get(url + str(page), headers=header)
|
||||
data = r.json()
|
||||
for x in data['content']:
|
||||
web['Date'].append(x['drawingDate'])
|
||||
web['Date'].append(records.draw_day(x))
|
||||
web['Numbers'].append('–'.join(str(n['data']) for n in x['resultData'] if n['type'] == 'REGULAR'))
|
||||
if data['last']:
|
||||
break
|
||||
@@ -29,7 +30,8 @@ def get_data():
|
||||
dfs = [pd.DataFrame(web)]
|
||||
pd.set_option('display.max_rows', None)
|
||||
# Specifies no max rows, otherwise only shows 10 records
|
||||
df = pd.concat([dfs[0], salvaged], ignore_index=True)
|
||||
# Adds any draw not in the sheet yet, so the excel record keeps growing
|
||||
df = records.merge_save('./excel_lotto_records/daily4.xlsx', dfs[0], fallback=salvaged)
|
||||
df2 = df[['Date', 'Numbers']]
|
||||
date = list(df2['Date'])
|
||||
nums = list(df2['Numbers'].astype('str'))
|
||||
|
||||
Reference in new issue
Block a user