What is Numpy | Introduction to Numpy
Introduction to Numpy
In this article, we will cover the following :
- What is Numpy
- Numpy Import
- Creating a single-dimension array
- Operations on single dimensions array
- Creating a multi-dimension array
- Operations on multi-dimension array
What is Numpy
Numpy which stands for Numerical Python is one of the libraries for the scientific computing used in Python. It allows user to create a multidimensional array in python and perform the various scientific tasks. Its syntax makes it accessible and productive for any programmers to be at any experience level. It is fast and versatile which enables various mathematical functions and also algebra operations. It does have the ability to perform the Fourier transformation and random number capabilities.
How to import Numpy
After the successful installation of the Numpy library in your machine, it is very much required to import the library in your program to add the ability to perform the operations supported by Numpy.
import numpy as np
How to create a single dimension array
import numpy as np
a = np.array([4,5,6])
Operations on single-dimension array
import numpy as np
a = np.array([4,5,6])
a.dtype #to_check_datatype
a.shape #to_check_shape
a.ndim #to_check_the_dimension
Although these are some of the very basic operations, illustrated to enable you to know the functionality.
Creating a multidimensional array
import numpy as np
b = np.array([[2,6,8],[9,6,4],[6,4,7]])
Operations on multidimensional array
b.dtype #datatype
b.shape #to_understand_shape
b.itemsize #to_get_size_in_bytes
b.ndim #to_get_dimension
b.data #to_get_buffer_actually_containing_array