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
- What is Numpy and use cases of Numpy? – Covers arrays, features, architecture and installation, with basic step-by-step tutorials to get started.
- What is Anaconda? – Sets up a Python data environment with Conda and explains Anaconda versus Miniconda.
- Jupyter notebook – Lab Session – 11 – Numpy Introduction – Hands-on first practice with arrays and core numerical operations in Jupyter Notebook.
- Jupyter notebook – Lab Session – 1 – Exploring Dataset with Pandas and NumPy – Applies NumPy and pandas to a real dataset with read_csv, head, info and more.
- Jupyter notebook – Lab Session – 8 – Calculating Descriptive Statistics with math, statistics, numpy, pandas – Computes mean, median, variance and percentiles across libraries, including handling NaN values.
- Jupyter notebook – Lab Session 3 – Visualizing Data with Pandas, NumPy, matplotlib & seaborn – Turns NumPy and pandas results into charts with matplotlib and seaborn.
- PyTorch Lab – 3 – Pytorch Conversions Between PyTorch And NumPy – Bridges NumPy to deep learning by converting arrays and tensors and explaining shared memory.
- Top 50 Numpy interview questions and answers – Checks your fundamentals before an interview, from installation to creating 1D and 2D arrays.
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…
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…
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…
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…
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…
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…
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…
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…
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,…
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…
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…
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…
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…
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.
