Jupyter
Overview
Jupyter is an interactive computing platform that combines code execution, rich output (tables, plots, widgets), and narrative text in notebook documents. It supports multiple kernels (Python, R, Julia), integrates with matplotlib, plotly, and ipywidgets for visualization, and enables reproducible research through nbconvert for report generation and papermill for parameterized batch execution.
Instructions
- When building notebooks, organize cells with a clear flow: imports, data loading, exploration, analysis, and conclusions, using Markdown cells for narrative context between code cells.
- When sharing notebooks, restart the kernel and "Run All" to ensure cells execute in order, then use
nbconvert to generate HTML, PDF, or slides with --no-input for non-technical audiences.
- When managing environments, install kernels from virtual environments with
python -m ipykernel install --user --name=myenv and pin dependencies with %pip install package==1.2.3 in the first cell.
- When developing iteratively, use
%autoreload 2 to auto-reload imported modules on change, and extract proven code into .py modules for reuse.
- When version controlling, use
jupytext to pair .ipynb with .py files that diff cleanly, or use nbstripout to strip output before Git commits.
- When running in production, use
papermill to parameterize and execute notebooks programmatically for batch report generation.
Examples
Example 1: Build an exploratory data analysis notebook
User request: "Create a Jupyter notebook for EDA on a customer dataset"
Actions:
- Set up the notebook with imports,
%matplotlib inline, and data loading from CSV/Parquet
- Add summary statistics cells with
df.describe(), df.info(), and missing value analysis
- Create visualization cells with distribution plots, correlation heatmaps, and time series charts
- Add Markdown cells with findings and conclusions between analysis sections
Output: A well-structured EDA notebook with statistics, visualizations, and narrative ready for sharing.
Example 2: Automate weekly reports with papermill
User request: "Generate weekly sales reports from the same notebook with different date parameters"
Actions:
- Create a template notebook with tagged parameter cells for date range
- Use
papermill to execute the notebook with different parameters per week
- Convert output notebooks to HTML with
nbconvert --no-input for executive-friendly reports
- Schedule execution via cron or CI pipeline
Output: Automated weekly HTML reports generated from a parameterized notebook template.
Guidelines
- Restart kernel and "Run All" before sharing to ensure cells execute reliably in order.
- Use
%autoreload 2 during development to reload imported modules without restarting the kernel.
- Use
jupytext for Git since .py files diff cleanly while .ipynb outputs pollute version control.
- Pin environment dependencies in the first cell for reproducibility.
- Use
papermill for batch execution with parameters instead of manual re-runs.
- Split exploration from production: explore in notebooks, extract proven code to Python modules.
- Keep notebooks under 200 cells; split large analyses into multiple focused notebooks.
1---2name: jupyter3description: Jupyter4---5# Jupyter67## Overview89Jupyter is an interactive computing platform that combines code execution, rich output (tables, plots, widgets), and narrative text in notebook documents. It supports multiple kernels (Python, R, Julia), integrates with matplotlib, plotly, and ipywidgets for visualization, and enables reproducible research through nbconvert for report generation and papermill for parameterized batch execution.1011## Instructions1213- When building notebooks, organize cells with a clear flow: imports, data loading, exploration, analysis, and conclusions, using Markdown cells for narrative context between code cells.14- When sharing notebooks, restart the kernel and "Run All" to ensure cells execute in order, then use `nbconvert` to generate HTML, PDF, or slides with `--no-input` for non-technical audiences.15- When managing environments, install kernels from virtual environments with `python -m ipykernel install --user --name=myenv` and pin dependencies with `%pip install package==1.2.3` in the first cell.16- When developing iteratively, use `%autoreload 2` to auto-reload imported modules on change, and extract proven code into `.py` modules for reuse.17- When version controlling, use `jupytext` to pair `.ipynb` with `.py` files that diff cleanly, or use `nbstripout` to strip output before Git commits.18- When running in production, use `papermill` to parameterize and execute notebooks programmatically for batch report generation.1920## Examples2122### Example 1: Build an exploratory data analysis notebook2324**User request:** "Create a Jupyter notebook for EDA on a customer dataset"2526**Actions:**271. Set up the notebook with imports, `%matplotlib inline`, and data loading from CSV/Parquet282. Add summary statistics cells with `df.describe()`, `df.info()`, and missing value analysis293. Create visualization cells with distribution plots, correlation heatmaps, and time series charts304. Add Markdown cells with findings and conclusions between analysis sections3132**Output:** A well-structured EDA notebook with statistics, visualizations, and narrative ready for sharing.3334### Example 2: Automate weekly reports with papermill3536**User request:** "Generate weekly sales reports from the same notebook with different date parameters"3738**Actions:**391. Create a template notebook with tagged parameter cells for date range402. Use `papermill` to execute the notebook with different parameters per week413. Convert output notebooks to HTML with `nbconvert --no-input` for executive-friendly reports424. Schedule execution via cron or CI pipeline4344**Output:** Automated weekly HTML reports generated from a parameterized notebook template.4546## Guidelines4748- Restart kernel and "Run All" before sharing to ensure cells execute reliably in order.49- Use `%autoreload 2` during development to reload imported modules without restarting the kernel.50- Use `jupytext` for Git since `.py` files diff cleanly while `.ipynb` outputs pollute version control.51- Pin environment dependencies in the first cell for reproducibility.52- Use `papermill` for batch execution with parameters instead of manual re-runs.53- Split exploration from production: explore in notebooks, extract proven code to Python modules.54- Keep notebooks under 200 cells; split large analyses into multiple focused notebooks.