title: Two-sample Kolmogorov-Smirnov Test in Python Scipy on brain data
body: <p>I have brain anatomy measurements from 2 different groups of individuals. One group has more individuals than the other (say n and m individuals each). I have to run the KS test on this data. I am a little unclear about the arguments to pass to the scipy two sample KS test. Will arguments to the scipy 2 sample ks test be every individual from group 1 against every individual in group 2 in a for loop ? Or is it every feature in group 1 against every other feature in group 2 ?</p>
  
  <p>I wrote this code but it's obviously wrong as i am using iteritems() to loop over the columns when perhaps it should be n*m ?</p>
  
  <pre><code>for group1, group2 in zip(group1.transpose().iteritems(), 
  group2.transpose().iteritems()):
  
      value, pvalue = ks_2samp(np.array(group1[1]), np.array(group2[1]))
      print(value, pvalue)
      if pvalue &gt; 0.05:
          print('Samples are likely drawn from the same distributions 
          (fail to reject H0)')
      else: 
          print('Samples are likely drawn from the different 
          distributions (reject H0)')
  </code></pre>