1 回答

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超4個贊
可能我正在尋找類似的東西 - 它的運(yùn)行速度快了 23 倍。但尚未在整個數(shù)據(jù)集上進(jìn)行測試!
# Optimization 2: Try out using Numpy array :
start_time = time.time_ns()
start_time_s = time.time()
delta = 100
times = numpy.arange(start = start_time_s, stop =start_time_s + delta, step = 1)
times= numpy.expand_dims(times,1)
# print(times)
base = numpy.array(['Sam', 'Dam', 'pam'])
base= numpy.tile(base, (delta, 1))
# print(base)
result = numpy.concatenate((base, times), axis=1)
print('Time(μs) Taken to load :', (time.time_ns() - start_time)/1000)
print('Time(s) Taken to load :', time.time() - start_time_s)
添加回答
舉報