np.eye
import numpy as np
a=np.eye(3)
print(a)
a=np.eye(4,k=1)
print(a)
a=np.eye(4,k=-1)
print(a)
a=np.eye(4,k=-3)
print(a)
Impossible Ibis
import numpy as np
a=np.eye(3)
print(a)
a=np.eye(4,k=1)
print(a)
a=np.eye(4,k=-1)
print(a)
a=np.eye(4,k=-3)
print(a)
>>np.eye(3)
array([[ 1., 0., 0.],
[ 0., 1., 0.],
[ 0., 0., 1.]])
>>> np.eye(3)[1]
array([ 0., 1., 0.])