Numpy matrix.diagonal () method, we can find the
diagonal element from the given matrix and output the result as a one-dimensional matrix. p>
Return: Return diagonal element of a matrix
Example # 1:
In this example, we can see that using the
matrix. diagonal () we can find elements on the diagonal of the matrix.
Example # 2:
[[1 5 9]]