Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 0.22 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. simplify a loop in python
  2. final_fun=[]
  3. for i_base in xrange(n_base):
  4.   final_fun.append(sum(fun[:,i_base])/n_ci)
  5.        
  6. final_fun = [sum(fun[:,i_base])/n_ci for i_base in xrange(n_base)]
  7.        
  8. final_fun = fun.sum(axis=0) / n_ci