Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merging two noteboooks into one in Jupyter (ipython)

Tags:

jupyter

I have two different Jupyter notebooks for two different projects. I would like to merge them to get them both on the same notebook.

One way is to copy cells from one to the other one but it seems to be quite a bit of work for projects containing many cells. Is there a feature supporting importing Notebook documents or copying multiple cells at a time?

like image 499
dvillaj Avatar asked Nov 27 '15 12:11

dvillaj


People also ask

How do I merge notebook files?

Within your notebook, right-click the section tab above the page. In the context menu, select Merge into Another Section. A Merge Section dialog box will open, displaying notebooks that you save; you can also search for notebooks. At the left of the notebook, you want to merge sections click the plus button.

Can you work together on Jupyter Notebook?

The new collaborative editing feature enables collaboration in real-time between multiple clients without user roles, when sharing the URL of a document to other users, they will have access to the same environment you are working on (they can write and execute the cells).


Video Answer


2 Answers

You can merge notebooks with nbmerge

Install it with pip

pip install nbmerge 

and merge your files with

nbmerge file_1.ipynb file_2.ipynb file_3.ipynb > merged.ipynb 
like image 56
Cam Cairns Avatar answered Sep 16 '22 17:09

Cam Cairns


pip install nbmerge

nbmerge file_1.ipynb file_2.ipynb file_3.ipynb > merged.ipynb

full documentation - https://github.com/jbn/nbmerge

like image 29
LYu Avatar answered Sep 18 '22 17:09

LYu