↧
Answer by cottontail for How to filter rows of a numpy array
As @Roger Fan mentioned, applying a function row-wise should really be done in a vectorized fashion on the entire array. The canonical way to filter is to construct a boolean mask and apply it on the...
View ArticleAnswer by Roger Fan for How to filter rows of a numpy array
Ideally, you would be able to implement a vectorized version of your function and use that to do boolean indexing. For the vast majority of problems this is the right solution. Numpy provides quite a...
View ArticleHow to filter rows of a numpy array
I am looking to apply a function to each row of a numpy array. If this function evaluates to True I will keep the row, otherwise I will discard it. For example, my function might be:def f(row): if...
View Article