This doesn’t calculate accuracy. The true negatives are missing from the numerator of your fraction:
confusion_matrix.diag()/confusion_matrix.sum(1)

You are either calculating precision or recall. I don’t know which of the two, because I can’t tell which of the axis is prediction and which is ground truth.