You can do something like as follows.
import numpy as np
A = np.eye(3, 3)
B = np.eye(3, 3, k=-1)
B[B>0]=-1
C = A + B
C[0, 0] = 0
print(C)
Output:
[[ 0. 0. 0.]
[-1. 1. 0.]
[ 0. -1. 1.]]
solved python, change value of matrix eye [closed]