This Python script analyzes past winning numbers from Powerball and Mega Millions games and predicts potential future winning numbers based on frequency analysis. The script reads historical data from an Excel file, calculates the frequency of each number, and then generates possible combinations of numbers for the next draw.
- Frequency Analysis: Calculates the frequency of winning numbers and Powerball/Megaball numbers from historical data.
- Combination Generator: Generates unique combinations of the most frequent numbers.
- Prediction: Predicts the next set of winning numbers based on historical frequency data.
- Python 3.x
- Pandas (
pip install pandas) - OpenPyXL (
pip install openpyxl)
-
Clone or download the repository:
git clone https://github.com/flakkmonkey/LottoPrediction.git cd /path/to/download/directory -
Install required Python packages:
pip install pandas openpyxl
-
Prepare the Excel files (or use the Excel files provided in this repository):
- Create two Excel files named
powerball.xlsxandmegamillions.xlsx. - Each file should have a sheet named
winnerscontaining the following columns:Winning Numbers: A string of winning numbers separated by spaces (e.g., "04 15 24 35 58").Powerball(orMegaballfor Mega Millions): The Powerball/Megaball number (e.g., 14).
- Create two Excel files named
-
Run the script:
python lottery_prediction.py
-
Choose the game:
- You will be prompted to choose between Powerball and Mega Millions.
- Enter
1for Powerball or2for Mega Millions.
-
View Results:
- The script will output the six most frequently drawn winning numbers and the five most frequently drawn Powerball/Megaball numbers.
- It will also generate unique combinations of 5 numbers from the 6 most frequent winning numbers.
- Finally, it will predict the next set of winning numbers and the next Powerball/Megaball number based on historical data.
Choose a game (1 for 'Powerball' or 2 for 'Mega Millions'): 1
Six Most Frequently Drawn Winning Numbers:
Winning Number 15 appears 20 times
Winning Number 32 appears 18 times
...
Five Most Frequently Drawn Powerball/Megaball Numbers:
Powerball/Megaball Number 14 appears 10 times
...
Unique Combinations of 5 Numbers from the 6 Most Frequent Winning Numbers:
(15, 32, 12, 18, 25)
(15, 32, 12, 18, 44)
...
Predicted Next Winning Numbers: ['15', '32', '12', '18', '25']
Predicted Next Powerball/Megaball Number: 14
- The script assumes the historical data is clean and follows the expected format.
- The predictions are based on frequency analysis and should not be considered as guaranteed outcomes.