numpy.asanyarray() in Python

The asanyarray() function of Python numpy class converts the input to an ndarray, but pass ndarray subclasses through.

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.
order : This parameter states whether to use row-major (C-style) or column-major (Fortran-style) memory representation. By defaults it takes ‘C-style’.

 Return

This function returns an array interpretation of the parameter ‘arr’. If ‘arr’ is same as ndarray or is a subclass of ndarray, it is returnes the same value.

Example 1

Output

Example 2

Output

Pin It on Pinterest

Share This