Skip to content

array interface for scipy.sparse matrices? #4239

@shoyer

Description

@shoyer

I noticed the other day that scipy.sparse matrices do not implement numpy's ndarray interface. This means that calling np.asarray(sparse_matrix) yields a 0d array consisting of a sparse matrix, which I found rather strange.

Is there a principled reason for this?

If not, I would suggest adding a __array__ method (essentially as an alias for .todense()).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions