Run NumPy Online

NumPy Array

A NumPy ndarray stores values of one data type in an efficient multidimensional structure.

What is NumPy Array?

A NumPy ndarray stores values of one data type in an efficient multidimensional structure.

Create NumPy arrays and inspect their shape, size, and data type online.

When should you use it?

  • Perform numerical operations on many values at once.
  • Process arrays, matrices, and scientific data efficiently.
  • Prepare data for data science and machine learning.

Example code

Run code →
main.py
import numpy as np

values = np.array([[1, 2, 3], [4, 5, 6]])

print(values)
print("shape:", values.shape)
print("size:", values.size)

Expected output

[[1 2 3]
 [4 5 6]]
shape: (2, 3)
size: 6

How it works

The array is two-dimensional with two rows and three columns. Shape describes its dimensions and size counts all values.

Change the values and run the program in the CodeUtility online Python compiler without installing Python locally.

Practice exercises

Modify the runnable example with the exercises below to build understanding beyond copying the result.

  1. Change the input shape and dtype.
  2. Try negative, floating-point, and missing values.
  3. Apply the operation to larger multidimensional arrays and measure performance.
Run in Python IDE →