Add advanced pattern detection features to Powerball reader
- Enhanced CSV parsing script to include advanced statistical analyses. - Implemented functions to detect consecutive numbers, odd/even distributions, high/low distributions, sum patterns, gap patterns, hot/cold numbers, overdue numbers, number pairs, and decade distributions. - Integrated pattern analysis results into combination generation for more strategic number selection. - Updated main function to run advanced analyses and generate pattern-based combinations.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fix the powerball CSV file format."""
|
||||
|
||||
import shutil
|
||||
|
||||
# Read the original file
|
||||
with open('powerball_numbers.csv', 'r') as f:
|
||||
lines = f.readlines()
|
||||
|
||||
# Create backup
|
||||
shutil.copy('powerball_numbers.csv', 'powerball_numbers.csv.backup')
|
||||
|
||||
# Open output file
|
||||
with open('powerball_numbers.csv', 'w') as f:
|
||||
# Write header
|
||||
f.write('Draw Date,Winning Numbers,Multiplier\n')
|
||||
|
||||
# Process each line
|
||||
for line in lines:
|
||||
parts = line.strip().split(',')
|
||||
|
||||
# Extract components
|
||||
month = parts[0]
|
||||
day_year = parts[1].split('/')
|
||||
day = day_year[0]
|
||||
year = day_year[1]
|
||||
|
||||
# Format date as MM/DD/YYYY
|
||||
date = f"{int(month):02d}/{int(day):02d}/{year}"
|
||||
|
||||
# Get the 6 winning numbers (5 white balls + 1 powerball)
|
||||
numbers = ' '.join(parts[2:8])
|
||||
|
||||
# Get the multiplier
|
||||
multiplier = parts[8]
|
||||
|
||||
# Write the formatted line
|
||||
f.write(f'{date},{numbers},{multiplier}\n')
|
||||
|
||||
print("✓ File fixed! Created backup at powerball_numbers.csv.backup")
|
||||
print("\nFirst few lines of fixed file:")
|
||||
with open('powerball_numbers.csv', 'r') as f:
|
||||
for i, line in enumerate(f):
|
||||
if i < 5:
|
||||
print(line.strip())
|
||||
else:
|
||||
break
|
||||
Reference in New Issue
Block a user