Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python timeit结果中运行数和循环数之间的差异_Python_Timeit - Fatal编程技术网

Python timeit结果中运行数和循环数之间的差异

Python timeit结果中运行数和循环数之间的差异,python,timeit,Python,Timeit,我想检查在合并2个数据帧时使用数字查找值是否比使用字符串查找值快。为此,我将%timeit与以下代码一起使用: 在字符串查找值上合并: %timeit newframe = subframe.merge(frame, on = 'a string column', how = 'left') 结果:每个循环2.82 ms±22.4µs(7次循环的平均值±标准偏差,每个循环100次) 在数字查找值上合并: %timeit newframe = subframe.merge(frame, on =

我想检查在合并2个数据帧时使用数字查找值是否比使用字符串查找值快。为此,我将%timeit与以下代码一起使用:

在字符串查找值上合并:

%timeit newframe = subframe.merge(frame, on = 'a string column', how = 'left')
结果:每个循环2.82 ms±22.4µs(7次循环的平均值±标准偏差,每个循环100次)

在数字查找值上合并:

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

结果:每个循环2.88 ms±28.7µs(7次循环的平均值±标准偏差,每个循环100次)

我的问题是,在我的代码中,没有任何循环。我想知道timeit结果中的运行次数和循环次数之间有什么区别


7次运行是否意味着timeit模块运行合并7次,并计算这7次运行的平均值和std?如果是这样,循环意味着什么?

它会运行代码7*100次:每次运行7次,每次100个循环