Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Filter by
Sorted by
Tagged with
2 votes
2 answers
3k views

Extracting maximum values from each of the subsets of an array

Problem description: I have a numpy array cps from which I want to extract the maximum value in each of the subsets of the array (a subset is defined as non-zero ...
Dataman's user avatar
  • 227
4 votes
1 answer
439 views

Bernoulli trials using a condition in a vectorized operation

I was wondering how to vectorize the following code instead of using the for-loop and still be able to check for a condition. ...
Dataman's user avatar
  • 227