Convert the input to a ndarray, but pass ndarray subclasses through.
Parameters: | a : array_like
dtype : data-type, optional
order : {‘C’, ‘F’}, optional
|
---|---|
Returns: | out : ndarray or an ndarray subclass
|
See also
Examples
Convert a list into an array:
>>> a = [1, 2]
>>> np.asanyarray(a)
array([1, 2])
Instances of ndarray subclasses are passed through as-is:
>>> a = np.matrix([1, 2])
>>> np.asanyarray(a) is a
True