Skip to main content
The NumPy API provides a comprehensive set of functions and classes for scientific computing in Python.

Array Creation

NumPy provides various methods for creating arrays:

Basic Creation

Create arrays with specific values: empty, zeros, ones, full

From Existing Data

Create arrays from existing data structures

Numeric Ranges

Create arrays with evenly spaced values

Building Matrices

Create specialized matrix structures

Core Data Types

ndarray

The fundamental array object in NumPy. All array creation functions return ndarray objects.

dtype

Data type objects that describe the type of elements in an array.

Import Convention

NumPy is typically imported with the alias np:
import numpy as np
All examples in this documentation assume NumPy has been imported as np.

Build docs developers (and LLMs) love