title: Creating new array based on first element of each item in current array
body: <p>Please forgive me if my terminology isn't correct - I'm new to this!</p>
  
  <p>I'm trying to isolate certain entries based on the value of the first element in each item in an array and perform some operations on certain columns. Here's an example of the type of data I'm working with:</p>
  
  <pre class="lang-py prettyprint-override"><code>[[1, 99, 400],
  [1, 95, 200],
  [2, 92, 100],
  [1, 85, 500],
  [2, 88, 300]]
  </code></pre>
  
  <p>I need to figure out the means of columns 2 and 3 using a <code>for loop</code>, <code>if statement</code>, and arithmetic, respectively, for each condition (reflected in column 1, where values are either 1 or 2).</p>
  
  <p>I'm trying to split the above array into two separate arrays for each condition, and then taking the mean of those columns using <code>numpy.mean</code>. 
   Here's what I want the lists to look like:</p>
  
  <pre class="lang-py prettyprint-override"><code>cond1 = [[1, 99, 400], [1, 95, 200], [1, 85, 500]]
  cond2 = [[2, 92, 100], [2, 88, 300]]
  </code></pre>
  
  <p>I'm stuck on how to separate these conditions into two new arrays based on the first element. Here's the furthest I've gotten after googling about slicing.. but I'm stuck!</p>
  
  <pre class="lang-py prettyprint-override"><code>for x in stim:
      if stim_acc[0]==1.0:
          np.where(stim_acc[0] = 1.0)
          cond1 = [[s,a,rt] for s, a, rt in zip(stim, acc, mrt)]
          print(cond1)
  </code></pre>
  
  <p>regarding <code>stim</code>, <code>acc</code>, and <code>mrt</code>:</p>
  
  <p>I have a several column-long set of data from which I isolated the stimulus (now <code>stim</code>), accuracy (now <code>acc</code>), and mean reaction time (now <code>mrt</code>) entries into a new list (the first in this post). I did this like so:</p>
  
  <pre><code>stim = data[:,1]
   acc = data[:,3]
   mrt = data[:,4]
  
   stim_acc = [[s, a, rt] for s, a, rt in zip(stim, acc, mrt)]
   print(stim_acc)
  </code></pre>
  
  <p>I've preemptively named the new list <code>stim_acc</code> because i foresaw this turning into a list calculating the accuracy for each condition over a loop.</p>
  
  <p>Thank you, any help is greatly appreciated.</p>