如果我在同一台服务器上运行多个 IPython 笔记本。有没有办法在他们之间共享数据?例如,从另一个笔记本导入变量?谢谢!
最佳答案
这对我有用:
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
我已经成功测试了 sklearn 数据集:
from sklearn import datasets
dataset = datasets.load_iris()
%store dataset
在笔记本中读取数据:
%store -r dataset
源代码:https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/
关于python - 在 IPython Notebooks 之间共享数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31621414/