Python and JupyterLab notebooks for drafting and maintaining a fantasy baseball team.
This project is primarily for personal use, but it is organized to be clean, reproducible, and easy for others to run locally.
- Pulling MLB data for fantasy baseball workflows (draft prep and in-season management).
- Exploring player performance with basic and intermediate statistics.
- Building lightweight, reusable modeling workflows (including basic sabermetric-style analysis).
- Caching pulled data in Parquet format for fast iteration in notebooks.
These steps assume pyenv is installed on your machine.
-
Install and activate the Python version used by this repo:
pyenv install -s 3.13.0 pyenv local 3.13.0 -
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate -
Install dependencies:
pip install --upgrade pip pip install -r requirements.txt
-
Start JupyterLab:
jupyter lab
jupyterlabfor notebook developmentipywidgetsfor notebook UI controlsipydatagridfor interactive spreadsheet-like table browsing in notebookspybaseballfor MLB data collectionpandasfor data wranglingpyarrowfor Parquet-based caching/storage
notebooks/contains all Jupyter notebooks for this project.requirements.txtcontains Python dependencies.README.mdcontains setup guidance and project notes.
The notebooks/draft_helper.ipynb notebook uses ipywidgets and ipydatagrid for the tabbed hitter/pitcher UI.
If the final display(tab) cell runs but no grid appears:
-
Confirm the environment has the widget packages installed:
pip install -r requirements.txt
-
Verify Jupyter can see the widget extensions:
jupyter labextension list
-
Restart JupyterLab and restart the notebook kernel, then run all cells from the top.
-
If output is still blank, trust the notebook and reload it:
- In JupyterLab:
File->Trust Notebook - Refresh the browser tab and rerun the notebook
- In JupyterLab:
pybaseball automatically uses its own cache once cache.enable() is called in the notebook.
- Initial draft board and player pool pull
- Position scarcity exploration
- Recent performance window analysis
- Player status and transaction monitoring notebook
- Simple model-based ranking experiments