Numpy Flatten Tutorial | numpy.ndarray.flatten()

Numpy Flatten Tutorial numpy.ndarray.flatten()

Introduction

In Python Numpy library numpy.ndarray.flatten() is used to flatten multi-dimensional arrays into one-dimensional arrays. In this article, we will explore the syntax, functionality, and various examples of np.flatten() function.

Syntax

The syntax for Numpy flatten() is straightforward as shown below :

numpy.ndarray.flatten(order=ā€™Cā€™)

Parameters:

  • order (optional): The order parameter determines how elements are arranged in the flattened array. It can take any of the following values:

Leave a Reply