A data analysis toolkit that evaluates NFL player projections against actual performance. This project ingests data from various sources, performs statistical regression analysis to determine optimal weighting formulas, and generates detailed PDF reports and CSV datasets.
- Data Ingestion: Fetches projection data from community repositories (e.g.,
hvpkod/NFL-Data) and actual performance statistics vianflreadpy. - Statistical Analysis: Uses linear regression (
scikit-learn) to analyze the correlation between projected and actual points. - Visualizations: Generates scatter plots and correlation charts using
seabornandmatplotlibto visualize performance trends by position (QB, RB, WR, TE). - Automated Reporting: Produces a comprehensive PDF report (
Detailed_NFL_Analysis.pdf) summarizing findings, including methodology, statistical insights, and embedded visualizations. - Data Export: Outputs processed data to
detailed_nfl_data.csvfor further external analysis.
- Python 3.8+
- Internet connection (for fetching data)
-
Clone the repository:
git clone https://github.com/yourusername/nfl-analysis.git cd nfl-analysis -
Create and activate a virtual environment (optional but recommended):
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required dependencies:
pip install pandas numpy matplotlib seaborn scikit-learn fpdf nflreadpy
The analysis year is currently hardcoded in nfl_detailed_analysis.py. To change the season being analyzed:
- Open
nfl_detailed_analysis.py. - Locate the
YEARvariable near the top of the file:# --- Configuration --- YEAR = 2025
- Update it to the desired season (e.g.,
YEAR = 2024).
Run the main analysis script to generate the report and data files:
python nfl_detailed_analysis.pycheck_pos.py: A quick utility to verify available player positions in thenflreadpydataset for the current/target season.nfl_prediction_analysis.py: Legacy script for earlier versions of the analysis logic.
After running the main script, the following files will be generated in the project root:
Detailed_NFL_Analysis.pdf: A multi-page report containing:- Executive Summary
- Methodology
- Position-specific analysis (QB, RB, WR, TE)
- Visualization charts (Correlation matrices, Scatter plots)
detailed_nfl_data.csv: The raw dataset used for the analysis, containing merged projection and actual performance data.*.png: Temporary image files generated during the execution (cleaned up or overwritten in subsequent runs).
.
├── nfl_detailed_analysis.py # Main application entry point
├── AGENTS.md # Guidelines for AI agents and contributors
├── check_pos.py # Utility for data validation
├── Detailed_NFL_Analysis.pdf # Generated Report (Output)
├── detailed_nfl_data.csv # Generated Data (Output)
└── ...
See AGENTS.md for detailed guidelines on code style, conventions, and operational workflows for this project.
MIT (or appropriate license)