title: ANOVA for groups within a dataframe using scipy
body: <p>I have a dataframe as follows. I need to do ANOVA on this between three conditions. The dataframe looks like:</p>
  
  <pre><code>data0 = pd.DataFrame({'Names': ['CTA15', 'CTA15', 'AC007', 'AC007', 'AC007','AC007'], 
      'value': [22, 22, 2, 2, 2,5], 
      'condition':['NON', 'NON', 'YES', 'YES', 'RE','RE']})
  </code></pre>
  
  <p>I need to do ANOVA test between YES and  NON, NON and RE and YES and RE, conditions from conditions for Names.
  I know I could do it like this,</p>
  
  <pre><code>NON=df.query('condition =="NON"and Names=="CTA15"')
  no=df.value
  YES=df.query('condition =="YES"and Names=="CTA15"')    
  Y=YES.value
  </code></pre>
  
  <p>Then perform one way ANOVA as following,   </p>
  
  <pre><code>    from scipy import stats                
      f_val, p_val = stats.f_oneway(no, Y)            
      print ("One-way ANOVA P =", p_val )
  </code></pre>
  
  <p>But would be great if there is any elegant solution as my initial data frame is big and has many names and conditions to compare between</p>