numpy.eye (R, C = No, k = 0, dtype = type & lt; & # 39; float & # 39; & gt;): Returns a matrix with 1 on the diagonal and 0 elsewhere relative to k .
R: Number of rows C: [optional] Number of columns; By default M = N k: [int, optional, 0 by default] Diagonal we require; k & gt; 0 means diagonal above main diagonal or vice versa. dtype: [optional, float (by Default)] Data type of returned array.
array of shape, R x C, an array where all elements are equal to zero, except for the k-th diagonal, whose values are equal to one.
Matrix b: [[1. 0.] [0. 1.]] Matrix a: [[0. 0. 0. 0. 0 .] [1. 0. 0. 0. 0.] [0. 1. 0. 0. 0.] [0. 0. 1. 0. 0.]]
These codes will not work for an online ID. Please run them on your systems to see how they work
This article is courtesy of Mohit Gupta_OMG