elegant-scipy / elegant-scipy-submissions

Submissions of code snippets for the book Elegant SciPy
13 stars 2 forks source link

to 2d bincount using coo_matrix #17

Closed amueller closed 8 years ago

amueller commented 8 years ago

A trick I like is using coo_matrix to do a 2d bincount by using the summing in creating a coo_matrix, such as here.

Not sure if that qualifies, it's more a recipe?

stefanv commented 8 years ago

Thanks @amueller! These are welcome, we can try and work them into side boxes.

jni commented 8 years ago

@amueller :+1:! I discovered this a few years ago myself, and it's soooo useful. =) We are writing a chapter on scipy.sparse so this will definitely be included in some form. Thanks!

jni commented 8 years ago

@amueller it's in! =) Will let you know when the book is out. =)

amueller commented 8 years ago

Sweet :) On Jan 6, 2016 21:39, "Juan Nunez-Iglesias" notifications@github.com wrote:

@amueller https://github.com/amueller it's in! =) Will let you know when the book is out. =)

— Reply to this email directly or view it on GitHub https://github.com/HarrietInc/elegant-scipy-submissions/issues/17#issuecomment-169529034 .