np.array vs np.vstack
code:py
import numpy as np
N = 10
size = 100
print("np.array")
%timeit np.array(arrays)
print("np.vstack")
%timeit np.vstack(arrays)
print("np.stack(axis=0)")
%timeit np.stack(arrays, axis=0)
code:result
np.array
23.3 μs ± 585 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
np.vstack
24.6 μs ± 1.04 μs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
np.stack(axis=0)
27.8 μs ± 931 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
まあ同じくらいyosider.icon