Intro To NumPy Library

image.png

Image Credit: Datascientist.com

In this post, I am gonna talk briefly about theoretical concepts of NumPy library and the subsequent post after this one will be about various operations that we can do using NumPy library in Python. I will like to keep this post very short and not include any intermediate or complex programming examples. The term NumPy is short abbreviation for as Numerical Python is undoubtedly one of the popular programming language packages that is widely used for mathematical operations especially arrays and matrices manipulation even though it can be used to perform other high level operations efficiently that a normal python code can't do. NumPy library consists of a mixed code written in Python and C language.

image.png

Image Credit: Data Flair

Applications of NumPy

NumPy can be used across myriads of fields which are not limited to:

1. Data Science


NumPy functions make it easier to process and manipulate the date for analysis, visualization and prediction. Perhaps, this is the one of the popular domain where NumPy is widely used today.

2. Simulation

As mentioned before due to its ability to perform numerical calculation efficiently, NumPy becomes a great choice for simulation in Physics, Gaming, Robotics, Population and Ecosystem.

3. Image Processing

NumPy is used to perform varieties of image processing tasks like loading/saving the image, resizing the image, concatenate images and so on. This makes it popular package in computer vision and medical imaging.

4. Miscellaneous


Other fields where NumPy libraries are used include Machine Learning/Artificial Intelligence, Software and Game Development, Statistical Computing and so on.

Why Use NumPy Over Traditional Python Code


Ok this question might run in your head like what advantages does NumPy offer over traditional python code. I have listed them down below:

1. Efficient Mathematical Operation


Almost all of the calculation in NumPy is done in arrays and matrices that stores data of same data type and is of fixed size. While in Python such operations are done using list which dynamically allocates memory and space, stores values of different data types making operations inefficient.

1. Better Memory Allocation


As I mentioned before, NumPy is a mix of Python and C language. It includes most of the functions in C that makes memory management so much efficient.

2. Mathematical Functions

NumPy has wide range of functions that can make multi-dimensional array operation, linear algebra, statistical operation very easier. It also makes indexing, slicing much more convenient than traditional Python code.

3. Better Performance


Due to the optimized code for all of the mathematical operations, NumPy makes it a fabulous choice over traditional Python code.

It is also worth mentioning that NumPy serves as a foundational concepts while working with other popular python packages like: pandas, matplotlib, SciPy, PyTorch and so on.

Installing NumPy

In order to install NumPy, you first need to have python installed in your machine. Then you can head to your Command Prompt or your terminal and run pip install numpy. It will run the latest version of numPyin your machine. To check whether numpy has been installed in your computer or not open your favorite's Python IDE and write a basic code like:

import numpy as np

np.add(2,3)



The output will be 5 as below:

image.png

Well, I would like to end this post for here now. From here, we will be dealing with NumPy overview and various mathematical operations in NumPy in further posts. Thanks for now.



0
0
0.000
3 comments
avatar

Good stuff, nice to see more python related content here. I've used numPy some but interested to learn more with it from any of your future posts!

0
0
0.000
avatar

That'll be great. Watch out for my future posts then. In the meantime there should be some numPy tutorial already here from other users. Check that out as well🙂

0
0
0.000
avatar

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support. 
 

0
0
0.000