Simple way to measure cell execution time in ipython notebook

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

    Use cell magic and this project on github by Phillip Cloud:

    Load it by putting this at the top of your notebook or put it in your config file if you always want to load it by default:

    %install_ext https://raw.github.com/cpcloud/ipython-autotime/master/autotime.py
    %load_ext autotime
    

    If loaded, every output of subsequent cell execution will include the time in min and sec it took to execute it.

提交回复
热议问题