Discover more from Daily Dose of Data Science
Specify Loops and Runs In %%timeit
We commonly use the %𝘁𝗶𝗺𝗲𝗶𝘁 (or %%𝘁𝗶𝗺𝗲𝗶𝘁) magic command to measure the execution time of our code.
Here, 𝘁𝗶𝗺𝗲𝗶𝘁 limits the number of runs depending on how long the script takes to execute. This is why you get to see a different number of loops (and runs) across different pieces of code.
However, if you want to explicitly define the number of loops and runs, use the -𝗻 and -𝗿 options. Use -𝗻 to specify the loops and -𝗿 for the number the runs.
Read this post on LinkedIn: Post Link.
Thanks for reading Daily Dose of Data Science! Subscribe for free to learn something new and insightful about Python and Data Science every day. Also, get a Free Data Science PDF (250+ pages) with 200+ tips.