Curriculum
Course: NumPy
Login

Curriculum

NumPy

Text lesson

Flattening the arrays

Flattening an array means transforming a multidimensional array into a 1-D array, which can be accomplished using reshape(-1).

Example

import numpy as np

arr = np.array([[123], [456]])

newarr = arr.reshape(-1)

print(newarr)