I am looking for a way to get multiple results for one condition of a numpy array.
Currently, I run the same where condition twice on the same numpy array, to get two new arrays with different output.
import numpy as np
np_array = np.random.rand(3,3)
entry_array = np.where(np_array>=0.5,1,0)
mod_array = np.where(np_array>=0.5,np_array,0)
Does a possibility exists where I can fill the two new arrays entries, mod_array with only one loop over np_array.
Additionally, I am also looking for a solution for non-array output, like the following.
entries = np.where(np_array>=0,1,0).sum()
sum_entries = np.where(np_array>=0,np_array,0).sum()
I am especially interested in an efficient way, as my arrays have more than 100 million entries.
