KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an NxM array in numpy that I would like to take the log of, and ignore entries that were negative prior to taking the log. When I take the log of negative entries, it returns -Inf, so I will have a matrix with some -Inf values as a result. I then want to sum over the columns of this matrix, but ignoring the -Inf values -- how can I do this? For example, mylogarray = log(myarray) # take sum, but ignore -Inf? sum(mylogarray, 0) I know there's nansum and I need the equivalent, something like infsum. Thanks.
Tags (comma-separated)
Save Edits
Cancel