Posts

Showing posts with the label numpy

Transpose of Array| Numpy tutorial | Data Science | Codin India

Image
  In the last post, we learned about reshaping the Numpy array. In this post, we will learn about the transpose of nd-array. Another very interesting reshaping method of Numpy is the   Transpose()   method.   Transpose is an very important topic when we talk about matrices and arrays. In linear algebra, the transpose of a matrix is an operator which flips a matrix over its diagonal. i.e.  It takes the input Array and swaps the rows and columns value and vica-versa. After transpose rows becomes columns and columns becomes rows.  Let us understand by code:-   Output:- It will convert rows into columns and columns to rows. I hope you will Like this post :) if you want to learn python then this tutorial will help you alot Python tutorial for beginners in hindi Please Subscribe to our Youtube Channel - Codin India

Array Concatenation and methods of stack | numpy array tutorial | Codin india

Image
    Numpy is Python module that is used for array creation, modification and creating sub arrays for numpy arrays. Concatenation of arrays Concatenation or joining of two arrays in Numpy, is primarily accomplished through the routines np.concatenate, np.vstack and np.hstack. Let us see all of the one by one. Concatenate:- It will concatenate two arrays and gives the output as one array. Let us see by code:- From the above code, it is clear that np.concatenate takes two argument as input and adds the value of both array and return the output as one array. Concatenate 3 or more arrays:- we can concatenate as any array we want. Let us talk, where the case of 3 arrays, we will concatenate all the 3 arrays Concatenation of same array:- We can also concatenate same array together. Like we can concatenate x + x. Let's see the Code:- NOTE:-   point here to be noted that, the arguments should be passed in [] brackets only.  np.concatenate([x, y]) 2-D or multidimensional Array Concatenation: