简体   繁体   中英

execute only some cells from a large jupyter notebook

I wanted to repeat an analysis included in a large jupyter notebook and save a couple of the generated dataframes in a csv file. My first attempt was to open the notebook in jupyter-lab and interactively run the cells I was interested, then add a new cell with my code that saves the relevant data to files.

I was wondering however if I could do the same thing with a script, eg run the 1st and 45th cell of the notebook and then run a few more commands to export the data.

cell 0

import IPython.display

cell 1

x = 1

cell 2

x = x + 1
print(x)

cell 3

IPython.display.Javascript("Jupyter.notebook.execute_cells([2])")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM