Handling this correctly automatically forces an excellent structure on the notebook.

The global, shared state identifies the core of the notebook. Ideally, the state is never mutated in place: instead any transformations are copied into a new variable.

Pure – side effect free – functions can work on the data, and automatically structure the notebook into stages. It also makes it trivial to write a quick test for the functions right next to them with toy inputs.

Retaining the original data and the lack of side effects makes it significantly easier to re-run sections of the notebook confidently.

One common example would the core dataset being analyzed in a notebook: it can be very valuable to have the original dataframe available, with any transformations creating copies.