Numpy – Introduction

What is Numpy?

NumPy is a python library that provides numerical computing for large, multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays efficiently. NumPy is the base library in the data science with python and used in fields such as machine learning, data analysis, scientific computing, and engineering.

Is Numpy Fast ?

NumPy is mostly written in C. The main advantage of Python is that there are a number of ways of very easily extending your code with C

Numpy provides a user-friendly & readable syntax for interacting data while still benefiting from the performance advantages of the C backend.

How To Install Numpy

Run command below in your terminal to install numpy by using python package installer (pip).

Python Lists vs Numpy Ndarray

  1. Performance: NumPy arrays are typically more efficient in terms of both memory usage and computational speed compared to Python lists.
  2. Size & Scalability: NumPy arrays are better suited for handling large datasets and multidimensional data compared to Python lists
  3. Functionality: Python lists offer basic functionality for storing and manipulating data but NumPy arrays provide a wide range of specialized functions and operations for numerical computing.
  4. Flexibility: Python lists can contain elements of different data types within the same list but NumPy arrays require all elements to have the same data type.

Python List to Numpy Arrays

How to define standart python lists:

How to convert python-list to numpy ndarray:

Basics of Numpy Ndarray

What is Ndarray?

A NumPy ndarray, short for N-dimensional array, is a fundamental data structure provided by the NumPy library for Python.

Ndarray Defination

Basic Numpy Array (ndarray) Defination :

\begin{bmatrix} 1 & 2 & 3 & 4 & 5 & 6 \end{bmatrix}
\begin{bmatrix} 1 \\ 2 \\ 3 \\ 4 \end{bmatrix}


How to define 1D Array in Numpy:

How to define 2D Array in Numpy:

How to define 3D Array in Numpy:

Shape of Any Array

View of any 1D array:

View of any 2D Array:

View of any 3D array:


Numpy is a third party numerical library that provides fast and large computing. Numpy eliminates all the shortcomings and needs of lists. Arrays could be 1D, 2D or 3D dimension.

ibrahim tunc
ibrahim tunc
Articles: 13

Leave a Reply

Your email address will not be published. Required fields are marked *