📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Python from Zero NumPy Basics

NumPy Basics

5 min read
NumPy provides fast multi-dimensional arrays. Create with np.array() or np.zeros(). Operations like arr * 2 apply to all elements instantly without loops. It is the foundation of Python data science.

NumPy — Numerical Computing

pip install numpy

import numpy as np

arr = np.array([1, 2, 3, 4, 5])
print(arr * 2)         # [2 4 6 8 10]
print(arr.mean())      # 3.0
print(arr.std())       # 1.414...

# 2D array
matrix = np.arange(9).reshape(3, 3)
print(matrix @ matrix.T)  # matrix multiplication