Jupyter notebook – Execute from Command Line with parameters
The best way to execute a jupyter notebook with parameters is to use Papermill
- install:
pip install papermill
- create a cell at the start of your jupyter notebook and add the tag:
parameters
- add your variables to that cell
1 2 |
project_key = 'some default value' date = '2021-09-10' |
- and execute the command
papermill my-jupyter-notebook.ipynb my-output-notebook.ipynb -p project_key data-science-proj-key -p date '2021-08-01'
--p
– the variable name and the value to be injected
More details here: papermill@github