NumPY is a Python module that provides efficient operations on arrays. NumPY is the fundamental package for scientific computing with Python. This package is commonly used for Python data analysis. A NumPY array is a grid of multiple values.
Install NumPY by running the following command in your Terminal:
$ pip3 install numpy
We are going to use this numpy library to do operations on a numpy array. Now we are going to see how to create numpy arrays. For that, create a script called simple_array.py and write following code in it:
import numpy as np
my_list1 = [1,2,3,4]
my_array1 = np.array(my_list1)
print(my_list11, type(my_list1))
print(my_array1, type(my_array1))
Run the script and you will get the following output:
student@ubuntu:~$ python3 simple_array.py
The output is as follows:
[1, 2, 3, 4] <class 'list'>
[1 2 3 4] <class 'numpy.ndarray...