How do I find which cells in a messy Jupyter notebook actually produced this plot or model, so I can clean it up?

Use a program slicer, which traces the code a result depends on. Static slicers such as Gather read the code without running it, so they keep extra cells. Our nbslicer tracks dependencies while cells run; on 374 real notebook sessions, its slices were on average 66% smaller than a static slicer's and still correct, and they ran 1.34x faster.

Sources: Bolt-on, Compact, and Rapid Program Slicing for Notebooks (VLDB 2023)

Guide: Interfaces for Data Work with LLMs

More questions on this topic

All questions about using AI for data and knowledge work