How to execute a python notebook inside another on

2019-05-30 15:34发布

问题:

I'd like to execute a python notebook I'had created to data pre-processing inside another notebook related with data classification process. So the last notebook depends on the functions and execution provided by the first notebook.

How could I do that at google cloud datalab environment? I do like to reuse the functions and variables used at the pre-processing notebook on the classification notebook.

Thanks.

回答1:

The following should work:

myNotebook = <relative path to notebook>

%run $myNotebook

or simply

%run <relative path to notebook>

Note: This does not work if you are running Datalab on Google Cloud Platform.