numpy.asanyarray() in Python

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



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’.


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


Example 2


Pin It on Pinterest

Share This