2011/10/21 Brian Holt <[email protected]>: > What is the difference between `asarray` and `asanyarray`? > > The documentation for `asanyarray` says: Convert the input to an > ndarray, but pass ndarray subclasses through. > The documentation for `asarray` says: Convert the input to an array. > > What I don't get is why `asanyarray` won't convert a `matrix`?
Because an np.matrix is an np.ndarray in the OO sense: >>> X = np.matrix(np.arange(10)) >>> isinstance(X, np.ndarray) True It's also the only such type that I know of (haven't played with masked arrays yet). scipy.sparse matrices do not pass the isinstance test, so they have to be dealt with specially anyway. -- Lars Buitinck Scientific programmer, ILPS University of Amsterdam ------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev _______________________________________________ Scikit-learn-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
