Simple way to measure cell execution time in ipython notebook

后端 未结 12 1430
春和景丽
春和景丽 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:46

    If you want to print wall cell execution time here is a trick, use

    %%time
    <--code goes here-->
    

    but here make sure that, the %%time is a magic function, so put it at first line in your code.

    if you put it after some line of your code it's going to give you usage error and not gonna work.

提交回复
热议问题