2
votes

I want to examine whether using a numeric lookup value in merging 2 dataframes is faster than using a string lookup value or not. for this purpose I used %timeit with below codes:

Merge on a string lookup value:

%timeit newframe = subframe.merge(frame, on = 'a string column', how = 'left')

result : 2.82 ms ± 22.4 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

Merge on a numeric lookup value:

%timeit newframe2 = subframe.merge(frame, on = 'a numeric column', how = 'left')

result : 2.88 ms ± 28.7 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

My question is that within my code, there were not any loops. I am wondering what is the difference between the number of runs and the number of loops in the timeit result?

Does 7 runs means that the timeit module runs the merge 7 times and calculating the mean and std for those 7 runs? and if so, what does loops mean?

1

1 Answers

3
votes

It runs your code 7 * 100 times: 7 runs of 100 loops each.