numpy
ScienceNumerical computing
What is numpy?
NumPy is the foundational package for scientific computing in Python. It provides a powerful N-dimensional array object, along with tools for integrating C and C++ code, linear algebra, Fourier transforms, and random number generation. Nearly every data science and machine learning library in the Python ecosystem is built on top of NumPy.
With PyRun, you can use NumPy directly in your browser — no pip install, no virtual environment, no setup. The full NumPy library is bundled inside Pyodide's WebAssembly distribution and loads automatically when your code imports it. This makes PyRun one of the fastest ways to experiment with numerical computing without touching your local machine.
Code Example
Matrix multiplication, dot product, and basic statistics.
import numpy as np
# Create two 3x3 matrices
A = np.array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
B = np.array([[9, 8, 7],
[6, 5, 4],
[3, 2, 1]])
print("Matrix A:\n", A)
print("\nMatrix B:\n", B)
# Matrix Multiplication
C = np.dot(A, B)
print("\nDot Product (A · B):\n", C)
# Element-wise operations
print("\nA + B:\n", A + B)
print("\nMean of A:", np.mean(A))
print("Std of A:", np.std(A).round(4))Why run numpy in PyRun?
- ✦ Zero setup — no pip install, no virtual environment, no Python download
- ✦ Instant results — powered by WebAssembly, runs locally in your browser
- ✦ Share your code — generate a link and anyone can run it instantly
- ✦ Works offline — after first load, PyRun runs without internet
Related Packages
Recommended Python Resources
Expand your knowledge with related interactive tutorials, cheat sheets, and code comparisons.
Python Loops
Learn how to use Python loops to iterate over data. Master for loops, while loops, break, continue, and loop best practices with interactive examples.
How to Sort a List in Python
Learn how to sort a list in Python using the sort() method and the sorted() function. Discover custom key sorting and reverse order examples.
Python NumPy Basics
Quick reference guide for NumPy arrays. Learn array creation, reshaping, indexing, slicing, and mathematical operations.
Python vs JavaScript: Which Programming Language is Best?
A comprehensive comparison between Python and JavaScript. Explore syntax differences, performance, use cases (backend vs frontend), and coding examples.