Python : Introduction To NumPy

Num Pi or Num P as it is commonly referred to is a Linear Algebra library for python. Almost all of the libraries in the PyData ecosystem reply on NumPy as one of their main building blocks. NumPy is incredibly fast.

The NumPy library can be installed using pip install command. In case you are new to installing libraries in python, I would recommend you to visit this link to get a deeper understanding on how to install libraries in python.

  • NumPy arrays will be widely used while working with data.
  • NumPy arrays essential come in two flavors : vectors and matrices.
  • NumPy Vectors are strictly 1 dimensional arrays and matrices 2 dimensional.
  • A matrix however can have just one row or just one column.

This should be sufficient for you to get started with NumPy. Let’s get started with using NumPy arrays in python using jupyter notebook.

Python : Installing The NumPy Package

How to install the numpy package within the python shell on a windows machine in less than 10 steps !

Unlike ‘ R ‘ the installation of packages in Python is slightly different.

Step1 : Open a command line window ( START > RUN > CMD )

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.


Step 2 : Navigate to the ” Python Scripts ” directory as shown below

C:\Users\harsh> CD C:\
C:\> CD Python27
C:\Python27> CD Scripts

Step 3 : make sure you are connected to the internet and then type pip install numpy

C:\Python27\Scripts> pip install numpy
Collecting numpy
 Downloading numpy-1.13.3-2-cp27-none-win32.whl (6.7MB)
 100% |################################| 6.7MB 85kB/s
Installing collected packages: numpy
Successfully installed numpy-1.13.3

Step 4 : Import numpy like you would import any other installed packages in Python on the Python Shell ! make sure numpy is all lower case else the package will not load and the shell will return an error.

Hope you found this post easy enough to get started with numpy.