How to Run a Cell in Jupyter Notebook Only If a Value Is Null?

22 Replies, 1902 Views

If you’re okay with using external tools, [Papermill](https://papermill.readthedocs.io/) is awesome for parameterizing and running notebooks. You can set conditions for cell execution and even skip cells based on values.

```python
import papermill as pm

if some_value is None:
pm.execute_notebook('input.ipynb', 'output.ipynb')
```

It’s a bit overkill for small tasks, but super useful for larger workflows.

Messages In This Thread



Users browsing this thread: 1 Guest(s)