numpy — Easy Examples
N-dimensional arrays, vectorized math, linear algebra, FFT
Getting started with numpy
Installation and basic usage of numpy.
python
import numpy as np arr = np.array([1, 2, 3, 4, 5]) print(f"Array: {arr}") print(f"Mean: {np.mean(arr)}") print(f"Sum: {np.sum(arr)}") print(f"Shape: {arr.shape}") matrix = np.array([[1, 2], [3, 4]]) print(f"\nMatrix:\n{matrix}") print(f"Transpose:\n{matrix.T}")
numpy is a third-party package. N-dimensional arrays, vectorized math, linear algebra, FFT. Install with: pip install numpy
Common numpy operations
Frequently used features of numpy.
python
import numpy print(f"numpy is ready to use") print(f"Available: {dir(numpy)[:10]}")
These are the most commonly used features of numpy in everyday development.
Want to try these examples interactively?
Open Easy Playground