pytorch learning journey Numpy Basics

Mondo Education Updated on 2024-02-09

numpyis a general-purpose array processing package. It provides a high-performance multidimensional array object, as well as tools for working with these arrays. It is a foundational package for scientific computing using Python.

In addition to its obvious scientific uses,numpyIt can also be used as an efficient cube container for general-purpose data.

numpyAn array in is a table of elements (usually numbers), all of the same type, indexed by a tuple of positive integers. In numpy, the dimensionality of the array is called the rank of the array. The shape of the array is given as an integer tuple along the size of each dimension. The array class in numpy is called ndarray. Elements in the numpy array are accessed using square brackets and can be initialized using nested python lists.

Create a numpy array Arrays can be created in numpy in a variety of ways, with different numbers of ranks, to define arrays.

size. Arrays can also be created using various data types, such as lists, tuples, and so on. The type of the generated array is derived from the type of the elements in the sequence.

Note: You can explicitly define the array type when creating an array.

Output:

There are a number of useful functions available in numpy for performing calculations on arrays, for examplesum: Used to add an array elementt: Used to transpose elements, etc.

Output:

The functions that numpy can use are as follows:

Related Pages