使用以坐标为参数的函数的结果初始化NumPy矩阵的最有效方法是什么? 目前,我只知道如何使用双循环,但我听说它对于NumPy矩阵通常不是最优的。= np.zeros((1000,1000))
for j in range(1000):
M[i][j] = f(i,j) #wheref is the desired function 有没有更好的方法来实现具有任意坐标函数结果的NumPy矩阵?我假设<e
我使用Table.read_where('condition')查询表,并为符合我的条件的每一行提供了一个numpy.void元素列表。有没有办法把这些行的列表变成Astropy表呢?Each numpy.void represents a row in my table.result = [row for row in DataTable.read_where('Condition')]
#I try to turn the list of rows into a Astropy