Share variables between different jupyter notebooks

user22710 picture user22710 · Mar 11, 2016 · Viewed 12.6k times · Source

I have two different Jupyter notebooks, running on the same server. What I would like to do is to access some (only a few of them) of the variables of one notebook through the other notebook (I have to compare if the two different versions of the algorithm give the same results, basically). Is there a way to do this?

Thanks

Answer

chabir picture chabir · Dec 8, 2017

Between 2 jupyter notebook, you can use the %store command.

In the first jupyter notebook:

data = 'string or data-table to pass'
%store data
del data

In the second jupyter notebook:

%store -r data
data

You can find more information at here.