如何在Numpy中使用timeit

问题描述

我正在尝试学习如何在Numpy中使用timeit。使用Python 3时,我陷入了基础。

import timeit

data = np.genfromtxt('data/example_data.csv',delimiter=';',names=True,dtype=None,encoding = 'UTF')

print(timeit.Timer(max([row[3] for row in data]))))```


Error that I am getting:

C:\Users\LucasBatistadosSanto\Documents\handsondata\ch_02>python pan.py
Traceback (most recent call last):
  File "pan.py",line 6,in <module>
    print(timeit.Timer(max([row[3] for row in data])))
  File "C:\Users\LucasBatistadosSanto\AppData\Local\Programs\Python\python37-32\lib\timeit.py",line 128,in __init__
    raise ValueError("stmt is neither a string nor callable")
ValueError: stmt is neither a string nor callable

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)