How to Create a NumPy Ndarray Object Using a Tuple


In this example, we will learn how to create a NumPy ndarray object using a tuple in Python.

Source Code

import numpy as np

n = np.array((1, 2, 3, 4))

print(n)

print(type(n))

Output:

[1 2 3 4]

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments