NumPy is the core Python library for numerical computing. Its n-dimensional array, ndarray, stores data of one type in contiguous memory and supports fast vectorized math, broadcasting, indexing and linear algebra. Pandas, matplotlib, SciPy and much of the machine learning stack are built on it or work closely with it.

The posts here start with overviews of what NumPy is, how it works, its architecture and use cases, and how to install it. Most of the hands-on material is a series of Jupyter Notebook lab sessions: an introduction to arrays, exploring a dataset with pandas and NumPy, analyzing earthquake data with time indexing, calculating descriptive statistics such as mean, median, variance and percentiles, and visualizing results with matplotlib and seaborn. A PyTorch lab shows how to convert between tensors and NumPy arrays and which conversions share memory.

Related guides cover Matplotlib and the Anaconda distribution, which many people use to set up a working environment. Two sets of interview questions round out the topic. The material suits Python beginners moving into data work, analysts and data scientists, and engineers preparing for data or machine learning roles.

Start here

Latest NumPy articles

Jupyter notebook – Lab Session – 8 – Calculating Descriptive Statistics with math, statistics, numpy, pandas

This lab calculates descriptive statistics in a Jupyter notebook with Python's built-in math and statistics modules, NumPy, SciPy and pandas. It covers central tendency (mean, weighted, harmonic…

Read More

Jupyter notebook – Lab Session – 2 – Analyzing Data with Pandas, NumPy & Visualizing Data with matplotlib

This lab loads a historical earthquake dataset into a Jupyter notebook with pandas, joins the separate Date and Time columns into one datetime column, and makes it…

Read More

PyTorch Lab – 3 – Pytorch Conversions Between PyTorch And NumPy

This lab shows how to convert data between PyTorch tensors and NumPy arrays using tensor.numpy(), torch.from_numpy(), torch.as_tensor() and torch.tensor(). The main point is memory: the first three…

Read More

Jupyter notebook – Lab Session – 11 – Numpy Introduction

Rajesh KumarI’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked…

Read More

Jupyter notebook – Lab Session 3 – Visualizing Data with Pandas, NumPy, matplotlib & seaborn

Rajesh KumarI’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked…

Read More

What is Anaconda?

Anaconda is a popular open-source distribution of the Python and R programming languages, designed specifically for scientific computing, data science, and machine learning. It provides a comprehensive…

Read More

Jupyter notebook – Lab Session – 1 – Exploring Dataset with Pandas and NumPy

Importing Libraries import pandas as pdimport numpy as np Explanation: Import the essential libraries. Loading the Dataset df = pd.read_csv(‘/path_to_your_dataset.csv’) Explanation: Load the dataset into a Pandas…

Read More

What is Matplotlib and use cases of Matplotlib?

What is Matplotlib? Matplotlib is a comprehensive 2D plotting library for the Python programming language. It is widely used for creating static, animated, and interactive visualizations in…

Read More

What is Numpy and use cases of Numpy?

What is Numpy? NumPy, short for Numerical Python, is a powerful open-source library for numerical computing in Python. It gives support for large, multi-dimensional arrays and matrices,…

Read More

What is Numpy and How it works? An Overview and Its Use Cases ?

What is Numpy ? NumPy is the central bundle for logical registering in Python. A Python library gives a complex cluster object, different determined objects (like concealed…

Read More

What is Numpy and How it works? An Overview and Its Use Cases

What is NumPy? Numpy is library for the Python programming language. NumPy is one of the most powerful Python libraries. It is a Python library that provides…

Read More

Top 50 Numpy interview questions and answers

1) What is Numpy? Ans: NumPy is a general-purpose array-processing package. It provides a high-performance multidimensional array object, and tools for working with these arrays. It is…

Read More

Top 50 interview questions and answers of Numpy

Introduction NumPy is the fundamental package for scientific computing in Python.NumPy arrays facilitate advanced mathematical and other types of operations on large numbers of data. Typically, such…

Read More

NumPy: frequently asked questions

Why is NumPy faster than Python lists?

NumPy arrays hold elements of a single type in contiguous memory, and operations run in compiled C code over the whole array instead of looping in Python. This vectorization removes per-element interpreter overhead.

How do I install NumPy?

Run pip install numpy, or conda install numpy if you use Anaconda or Miniconda. Then use import numpy as np in your code.

What is the difference between NumPy and pandas?

NumPy provides fast n-dimensional arrays and numerical operations. Pandas builds on NumPy to offer labeled tabular data with DataFrame and Series, plus tools for loading, cleaning, grouping and time-series work.

Do PyTorch tensors and NumPy arrays share memory?

torch.from_numpy() and tensor.numpy() on CPU tensors share the same memory, so changing one changes the other. torch.tensor() always copies the data.