Home › Python Data & ML › Python data & ML CLAUDE.md
Python data & ML CLAUDE.md
CLAUDE.md for data science / ML repos using pandas or polars, notebooks, and reproducible pipelines.
Claude Code (CLAUDE.md)Python Data & ML
How to use
Save this as CLAUDE.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.
CLAUDE.mdDownload # CLAUDE.md — Data & ML
## Environment
- `uv sync`; run with `uv run`. Python 3.12.
- Data lives in `data/raw` (read-only, never modify) → `data/processed` (generated).
## Rules
- Exploration can happen in `notebooks/`, but reusable logic must move to `src/` with tests.
- Prefer polars for new code; keep pandas where it already exists. Vectorize — no row-wise `apply` loops on large frames.
- Set random seeds and log them. Every experiment records params + metrics (MLflow or a JSON in `runs/`).
- Never train and evaluate on the same split; check for target leakage before reporting metrics.
- Plots: matplotlib/seaborn with labeled axes and units.
- Large files never go in git; use DVC or `.gitignore`.
## Done means
- `uv run pytest` passes, `uv run ruff check` clean, and results include the exact command to reproduce them.