0
我试图从graphlab SFrame访问多行并将它们转换为numpy数组。Graphlab Sframe,检索多行
我有一个96000行和4096列的数据库fd,需要检索存储在numpy数组中的行号。我提出的方法非常缓慢。我怀疑这是因为我在每次迭代中都不断增加sframe的大小,但我不知道是否有预分配值的方法。我需要抓取20000行并且当前的方法没有完成。
fd=fd.add_row_number()
print(indexes)
xs=fd[fd['id'] == indexes[0]] #create the first entry
t=time.time()
for i in indexes[1:]: #Parse through and get indeces
t=time.time()
xtemp=fd[fd['id'] == i]
xs=xs.append(xtemp) #append the new row to the existing sframe
print(time.time()-t)
xs.remove_column('id') #remove the ID Column
print(time.time()-t)
x_sub=xs.to_numpy() #Convert the sframe to numpy