简体   繁体   English

ipython笔记本“运行所有单元格”是同时执行还是按顺序执行?

[英]Does ipython notebook 'run all cells' execute simultaneously or in sequence?

I have a code that is applying changes to a dataset and then the next cell picks this up to continue with an other set of changes. 我有一个代码将更改应用于数据集,然后下一个单元格选择此更改以继续其他一组更改。 This is done for my own readability and troubleshooting in datamunging. 这是为了我自己的可读性和数据处理故障排除。

I think I finished the code and want to apply it to the initial data. 我想我完成了代码,并希望将其应用于初始数据。 Ipython notebook has an option run all cells. Ipython笔记本有一个运行所有单元格的选项。

My question is does it run them one after another or simultaneously ? 我的问题是它是一个接一个地或同时运行它们吗?

It runs in sequence. 它按顺序运行。 You will actually see the progress as the cells that are in queue will show a star In [*]: , while the cells that have successfully will show some number, ex.: In [123] . 您将实际看到进度,因为队列中的单元格将In [*]:显示星号,而成功的单元格将显示一些数字,例如: In [123]

It is very easy to see that it runs the cells sequentially. 很容易看出它依次运行细胞。 Simply change one cell to have something like 只需更换一个单元格即可

i = 39882

and in the following cell place 并在以下单元格位置

print i

If the cells would run concurrently, the latter cell would not print the value modified in the previous cell. 如果单元格将同时运行,则后一单元格将不会打印前一单元格中修改的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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