Open zkid18 opened 4 years ago
I might have missed something in official documentation, but I couldn't find a way to load the existed notebook. There is only an option of creating a new notebook
Thanks, that is pretty much what I was looking for.
For everyone who came across the same request I leave the updated code
nb = nbf.read('eda_new.ipynb', as_version=4)
text = """\
# Manual EDA with automatic notebook genration"""
code = """\
%pylab inline
hist(normal(size=2000), bins=50);"""
cells = [nbf.v4.new_markdown_cell(text), nbf.v4.new_code_cell(code)]
nb['cells'].extend(cells)
nbf.write(nb, 'eda_new.ipynb')
Decided to leave the issue open before anyone verify the code above.
The
nbf.write()
seems working pretty good with new notebook generation.But I couldn't find the same smooth method in
nbformat
to append cells to existed notebook. Is there a simpler way to that?