numpy.asanyarray(a,dtype=None,order=None)[source]¶Convert the input to an 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
asarrayascontiguousarrayasfarrayasfortranarrayasarray_chkfinitefromiterfromfunctionExamples
Convert a list into an array:
>>>a=[1,2]>>>np.asanyarray(a)array([1, 2])
Instances ofndarray subclasses are passed through as-is:
>>>a=np.matrix([1,2])>>>np.asanyarray(a)isaTrue