相关疑难解决方法(0)

在ipython笔记本中测量单元执行时间的简单方法

除了来自单元格的原始输出之外,我还想花费在单元格执行上花费的时间.

为此,我试过%%timeit -r1 -n1但它没有公开在单元格中定义的变量.

%%time 适用于仅包含1个语句的单元格.

In[1]: %%time
       1
CPU times: user 4 µs, sys: 0 ns, total: 4 µs
Wall time: 5.96 µs
Out[1]: 1

In[2]: %%time
       # Notice there is no out result in this case.
       x = 1
       x
CPU times: user 3 µs, sys: 0 ns, total: 3 µs
Wall time: 5.96 µs
Run Code Online (Sandbox Code Playgroud)

最好的方法是什么?

更新

我已经在Nbextension中使用Execute Time已经有一段时间了.太棒了.

python ipython ipython-notebook jupyter

148
推荐指数
14
解决办法
16万
查看次数

标签 统计

ipython ×1

ipython-notebook ×1

jupyter ×1

python ×1