[SciPy-User] how to get indices
Mon Sep 13 03:52:21 CDT 2010
On Mon, Sep 13, 2010 at 10:28 AM, Gael Varoquaux <
> On Mon, Sep 13, 2010 at 10:16:33AM +0200, Marcel Blattner wrote:
> > I have a small problem. I have for example a csc_matrix A. I want to
> > indices of values bigger then a treshold.
> > In numpy I simply can do: a,b = A > threshold...is there something
> > in Scipy?
> The difficulty here is that you are dealing with sparse matrices, for
> which access to data is not as simple. I believe the easiest option is to
> convert your matrix to coo, and operate directly on the row/col/data
> a = a.tocoo()
> mask = a.data > threshold
> col = a.col[mask]
> row = a.row[mask]
> SciPy-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User