首页 > 解决方案 > Python 魔术命令 %store 在 Google Colab 笔记本上不起作用

问题描述

我正在尝试在两个不同的 Google Colab 笔记本之间共享数据。

谷歌 Colab 笔记本 1:

(...)
data_structure = scaler.fit_transform(features)
%store data_structure

谷歌 Colab 笔记本 2:

%store -r data_structure 
print(data_structure)

运行 Notebook 1 后,我收到消息:Stored 'data_structure' (ndarray)。但是,当我运行 Notebook 2 时,我收到消息 error: no stored variable data_structure ... NameError: name 'data_structure' is not defined

由于笔记本位于不同的目录中,因此我也尝试在同一目录中运行它们。但是,我遇到了同样的问题。

有人可以帮忙吗?

标签: pythonjupyter-notebookgoogle-colaboratory

解决方案


推荐阅读