A web application for comparing NBA player statistics across different seasons. Built with Python, Flask, and BeautifulSoup.
- Compare any two NBA players' seasons side-by-side
- Extract stats from basketball-reference.com
- View 9 key statistics: PPG, MPG, FG%, 3PT%, eFG%, TS%, APG, RPG, Stocks, and Turnovers
- Color-coded comparison (green for better, yellow for ties)
- Recent comparisons history (up to 5)
- Dark mode interface
- Clone the repository
- Create a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Start the Flask server:
python3 app.py
- Open your browser to
http://localhost:5001 - Enter two player names and their respective seasons
- Click "Compare Stats" to see the comparison
app.py- Flask application and routesextract_table.py- Web scraping logic and stat extractiontemplates/- HTML templates (index.html, results.html)requirements.txt- Python dependencies
- The secret key in
app.pyis a placeholder. Change it for production use. - Stats are scraped from basketball-reference.com. Be respectful with request frequency.
- The application uses Flask sessions to store comparison history.