import pandas as pd
import numpy as np
rates=(pd.read_excel("C:\Anaconda3\RateMatrix.xlsx", sheetname="Pu239Test", skiprows=0)).as_matrix() #read the matrix values from excel spreadsheet, and converts the values to a matrix
rates is a 22 x 22 matrix.
I would like to replace the diagonal elements of the Rates matrix with the sum of all other elements in the row.
For example,
rates.item(0,0) = rates.item(0,1)+rates.item(0,2)+rates.item(0,3)+....rates.item(0,21)
rates.item(1,1) = rates.item(1,0)+rates.item(1,2)+rates.item(1,3)+....rates.item(1,21)
.....
rates.item(21,21) = rates.item(21,0)+rates.item(21,2)+rates.item(21,3)+....rates.item(21,20)
I was wondering how I can do that. Thanks a lot in advance.