• Gurobi Staff

Hi Marc,

The code

number = matrix.sum(axis=0)print(number)

provides

1 12 183 94 65 2dtype: int64

, i.e., the sum of each column saved as a $$\texttt{pandas Series}$$. You can access the value of the sum of the second column via

print(number[2])

which prints

18

The index of the columns is defined via your list $$\texttt{cities}$$.
It works the same for rows.

Best regards,
Jaromił

Hi Jaromił,

thanks for the explanation and solution! It works :)