在IPython笔记本之间共享数据 [英] Share data between IPython Notebooks
问题描述
如果我在同一台服务器上运行了几个IPython笔记本。有没有办法在它们之间共享数据?例如,从另一个笔记本导入变量?谢谢!
这对我有用:
%store命令允许你在两个不同的
笔记本之间传递变量。
data ='这是我要传递给不同笔记本的字符串'
%商店数据
现在,在一个新笔记本中...%store -r数据打印(数据)这是字符串
我想要传递到不同的笔记本
我已成功使用sklearn数据集进行测试:
<$来自sklearn导入数据集的p $ p>
dataset = datasets.load_iris()
%存储数据集
在笔记本中读取数据:
% store -r dataset
src: https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/
If I have several IPython notebooks running on the same server. Is there any way to share data between them? For example, importing a variable from another notebook? Thanks!
This works for me :
The %store command lets you pass variables between two different notebooks.
data = 'this is the string I want to pass to different notebook' %store data
Now, in a new notebook… %store -r data print(data) this is the string I want to pass to different notebook
I've successfully tested with sklearn dataset :
from sklearn import datasets
dataset = datasets.load_iris()
%store dataset
in notebook to read data :
%store -r dataset
src : https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/
这篇关于在IPython笔记本之间共享数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!