nbformat
nbformat copied to clipboard
Issue to modify a code cell source
Hi, I have a notebook which is a template. In one of the first code cells, I assign variable. For instance: SettlementAmount = SettlementAmount In a loop within python, I would like to produce multiple notebooks where for each new notebook, "SettlementAmount" is replaced in the notebook itself by a value, say 10, 20, 30, etc. I have been trying to investigate the nbformat library but cannot find out how to modify a cell copied from my notebook template. Basically, I cannot "set" the object MyNewNotebook.cells[i]['source']. Thank you very much for helping me. Best regards, Graziella
Have a look at nbparameterise: https://github.com/takluyver/nbparameterise
In particular, this example sounds quite similar to what you're asking: https://github.com/takluyver/nbparameterise/blob/master/examples/batch.py
Dear Thomas, I am very grateful for your quick reply. It seems to be what I am looking for... but I have some work ahead to investigate how to use the library in my case. I may have to revert again to you. Best regards, Graziella
2018-05-29 17:23 GMT+02:00 Thomas Kluyver [email protected]:
Have a look at nbparameterise: https://github.com/takluyver/nbparameterise
In particular, this example sounds quite similar to what you're asking: https://github.com/takluyver/nbparameterise/blob/master/examples/batch.py
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jupyter/nbformat/issues/126#issuecomment-392818179, or mute the thread https://github.com/notifications/unsubscribe-auth/AkJBieb_FTzkVVS-CC3_dkN3mXEfNws3ks5t3Wf-gaJpZM4URs41 .
@gradzie you might also want to look at https://github.com/nteract/papermill