这是我的密码
import numpy as np
contrainte1= 1080*0.65 # minutes tous les jours
contrainte2= 720*0.55 # minutes du lundi au vendredi
X=np.array([[9, 48],[12, 46],[14, 41],[12, 45],[6, 50],[10, 48],[25, 12],[26, 15],[30, 10],[31, 16],[40, 10],[41, 12],[35, 18],[35, 19],[30, 21],[28, 21],[25, 24],[21, 28],[22, 30],[25, 26],[26, 25],[30, 20],[32, 16],[35, 12]])<
#La première position représente la contrainte 1
#La deuxième position représente la contraire 2
# contrainte 1
for i in X[-19:]:
print(i)
for y in #This is where I need help
我想对每个数组(I)执行一个循环,在这个循环中,我将在数组的第一部分中计算每个值的和。在每个例子中,我想做9+12+14….+35的和np.总和()
当我尝试像SciPy展示给我的索引时,我似乎找不到技术来做我想要的。或者我就是不明白(语言障碍)
谢谢
如果我理解你的意思,你只想把第一列的元素求和?只需要一点索引和
sum
:相关问题 更多 >
编程相关推荐