title: setting null values in a numpy array
body: <p>how do I null certain values in numpy array based on a condition? 
  I don't understand why I end up with 0 instead of null or empty values where the condition is not met...  b is a numpy array populated with 0 and 1 values, c is another fully populated numpy array. All arrays are 71x71x166</p>
  
  <pre><code>a = np.empty(((71,71,166)))
  d = np.empty(((71,71,166)))
  for indexes, value in np.ndenumerate(b):
      i,j,k = indexes
      a[i,j,k] = np.where(b[i,j,k] == 1, c[i,j,k], d[i,j,k])
  </code></pre>
  
  <p>I want to end up with an array which only has values where the condition is met and is empty everywhere else but with out changing its shape</p>
  
  <p>FULL ISSUE FOR CLARIFICATION as asked for:<br>
  I start with a float populated array with shape (71,71,166)<br>
  I make an int array based on a cutoff applied to the float array basically creating a number of bins, roughly marking out 10 areas within the array with 0 values in between<br>
  What I want to end up with is an array with shape (71,71,166) which has the average values in a particular array direction (assuming vertical direction, if you think of a 3D array as a 3D cube) of a certain "bin"...<br>
  so I was trying to loop through the "bins" b == 1, b == 2 etc,  sampling the float where that condition is met but being null elsewhere so I can take the average, and then recombine into one array at the end of the loop....<br>
  Not sure if I'm making myself understood. I'm using the np.where and using the indexing as I keep getting errors when I try and do it without although it feels very inefficient.</p>