Last active
August 29, 2015 14:03
-
-
Save metafeather/99f45412554b672ceab6 to your computer and use it in GitHub Desktop.
IPython - executing other notebooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
from IPython.nbformat import current | |
def execute_notebook(nbfile): | |
with io.open(nbfile) as f: | |
nb = current.read(f, 'json') | |
ip = get_ipython() | |
for cell in nb.worksheets[0].cells: | |
if cell.cell_type != 'code': | |
continue | |
ip.run_cell(cell.input) | |
# Then in another notebook: | |
execute_notebook("loaddata.ipynb") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally by ncasagrande