擅长:python、mysql、java
<p>也许我遗漏了什么,但为什么不直接将元组列表传递给<code>np.array</code>?说如果:</p>
<pre><code>n = 100
l = [(0, 1, 2) for _ in range(n)]
arr = np.array(l)
x = arr[:, 0]
y = arr[:, 1]
z = arr[:, 2]
</code></pre>
<p>顺便说一句,我更喜欢使用以下时间代码:</p>
<pre><code>from timeit import default_timer as timer
t0 = timer()
do_heavy_calculation()
print("Time taken [sec]:", timer() - t0)
</code></pre>