我是一个初学者,试图独立地在多个数组上运行for循环,并将结果输出到多个csv文件。但是,我似乎无法从逻辑上弄明白。对于a,b,c输入数组,我想输出a1,a2,b1,b2,c1,c2数组。我的代码的缩短版本是这样的:
#get all elements of array:
a[:]
b[:]
c[:]
w8[:]
for i in ([a],[b],[c]):
#multiply values with weighting:
w = np.zeros((27,72))
w = np.multiply(i,w8)
#sum columns and rows:
suma0 = np.sum(w,axis=0)
suma1 = np.sum(w,axis=1)
#find the minimum values for rows and columns:
col_min=np.min(w)
col_min0=a.min(0)
row_min=np.min(w[:,27])
row_min0=a.min(1)
#Save as csv with pandas:
col_min0.to_csv('out1.csv', sep=',')
row_min0.to_csv('out2.csv', sep=',')
非常感谢任何帮助。