title: Python pandas dataframe restriction
body: <pre><code>series   outcome
  1          T
  1          F
  1          T
  2          T
  2          F
  3          T
  4          F
  4          T
  5          F
  </code></pre>
  
  <p>I have a data frame looking something like this and I  am trying to look at the proportion of T on the outcome for each series. However I do not understand why i m not being able to make it work</p>
  
  <pre><code>series = np.unique(series)
  count = 0 
  pcorrect = np.zeros(len(nseries))
  for s in nseries:
     if data.loc[data['series'] == s]:
         outcome_count = data['outcome'].value_counts()
         nstarted_trials = outcome_count['T'] + outcome_count[F'] 
         pcorrect[count]= outcome_count['T'] / nstarted_trials
      count +=1
  </code></pre>