code: def lkruskalwallish(*args):
      
      args = list(args)
      n = [0]*len(args)
      all = []
      n = [len(_) for _ in args]
      for i in range(len(args)):
          all = all + args[i]
      ranked = rankdata(all)
      T = tiecorrect(ranked)
      for i in range(len(args)):
          args[i] = ranked[0:n[i]]
          del ranked[0:n[i]]
      rsums = []
      for i in range(len(args)):
          rsums.append(sum(args[i])**2)
          rsums[i] = rsums[i] / float(n[i])
      ssbn = sum(rsums)
      totaln = sum(n)
      h = 12.0 / (totaln*(totaln+1)) * ssbn - 3*(totaln+1)
      df = len(args) - 1
      if T == 0:
          raise ValueError('All numbers are identical in lkruskalwallish')
      h = h / float(T)
      return h, chisqprob(h,df)
docs: The Kruskal-Wallis H-test is a non-parametric ANOVA for 3 or more
  groups, requiring at least 5 subjects in each group.  This function
  calculates the Kruskal-Wallis H-test for 3 or more independent samples
  and returns the result.  
  
  Usage:   lkruskalwallish(*args)
  Returns: H-statistic (corrected for ties), associated p-value