Curriculum
Course: NumPy
Login

Curriculum

NumPy

Text lesson

NumPy Creating Arrays

Create a NumPy ndarray Object

NumPy is designed for working with arrays, and its array object is called ndarray.

You can create a NumPy ndarray object using the array() function.

Example

import numpy as np

arr = np.array([12345])

print(arr)

print(type(arr))

To create an ndarray, you can pass a list, tuple, or any array-like object to the array() method, which will convert it into an ndarray.

Example

Create a NumPy array using a tuple:

import numpy as np

arr = np.array((12345))

print(arr)