identity The identity array is a square array with ones on the main diagonal. np.identity(1) >>> array([[1.]]) np.identity(2) >>> array([[1., 0.], [0., 1.]]) np.identity(3) >>> array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]) np.identity(4) >>> array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]])