Hey guys, i hope you are doing well

In the previous blog we learn about the 1d array and today we are going to continue our chapter by learning 2d array and if you want to read about 1d array than click here.

**2D array**

2d array or two-dimensional array if simply i said it’s a matrix, i which data is stored in rows and columns, 2d array is a collection of data which is arrange in the form of the matrix.

so, in this blog we are going to perform some operations on 2d array or we can say matrix like creating the matrix, learn how to find its transpose and lot of things, let’s start

**Remember to import numpy before creating the array*

**Create 2D array**

Here i create a 2D array or a matrix, named as `g`

, and here you can see i use different brackets in the inner most so, we can use either bracket `()/[]`

in inner most, output will be the same.

**Output**

**ndim, size, shape**

**ndim**– ndim is used to find the dimension of an array.**size**– size keyword is used to find the size of an array, it told the no of elements present in an array/matrix.**shape**– shape is used to find the no. of rows and columns present in the 2d array.

**Output**

**Create some matrix**

Here we create the matrix with 0 element.

**Output**

**Create a matrix with random value from 0 to 1**

here we create a matrix with random numbers from 0 to 1

**Output**

**Create some basic matrix**

**Unity matrix**– All elements are 1.**Diagonal matrix**– Only diagonal elements are non zero.

**Output**

**Reshaping the 2D array**

In this we are going to learn how we can convert 2D array into 1D array

**Output**

**Modify the shape in the original array form**

**Output**

**Create some array**

**Output**

**Now we are going to perform some operations on matrix**

In this we are going to do some basic operations on matrix like transpose of matrix, trace, inverse of matrix

**Output**

there are some more operations like

**Output**

Now we are going to create a 2D array or matrix on which we find some statistical values

**Input**

**Output**

so here we learn about the 2D array or Matrix, I hope you find it interesting and if you want to read some interesting blogs or articles click here in the next blog we are going to learn something really interesting so wait for it and till try this by your own.