Skip to content Skip to sidebar Skip to footer

How To Select And Sum On Only The First Column In An Array?

Here's my code 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,

Solution 1:

If I understood you, you just want to sum elements in the first column? All that needs is a little indexing and sum:

In [19]: X[:, 0].sum()
Out[19]: 600

Post a Comment for "How To Select And Sum On Only The First Column In An Array?"