numpy.ascontiguousarray() in Python

The ascontiguousarray() returns a contiguous array (ndim>= 1) in memory (C order).

Syntax

Parameter

arr : This parameter includes the input data, in any form that can be converted to an array. This includes lists, tuples, lists of tuples, tuples of tuples, tuples of lists etc.
dtype: It is an optional parameter. It depicts the data type of returned array, and by default, it is a float.

Return

This function returns a contiguous array (ndarray) of same shape and content as ‘arr’, with type specified in ‘dtype’.

Example 1

Output

Example 2

Output

Pin It on Pinterest

Share This