Simple way to measure cell execution time in ipython notebook

后端 未结 12 1427
春和景丽
春和景丽 2020-11-29 15:17

I would like to get the time spent on the cell execution in addition to the original output from cell.

To this end, I tried %%timeit -r1 -n1 but it does

12条回答
  •  被撕碎了的回忆
    2020-11-29 15:49

    You can use timeit magic function for that.

    %timeit CODE_LINE
    

    Or on the cell

    %%timeit 
    
    SOME_CELL_CODE
    

    Check more IPython magic functions at https://nbviewer.jupyter.org/github/ipython/ipython/blob/1.x/examples/notebooks/Cell%20Magics.ipynb

提交回复
热议问题