title: Jupyter notebook parallel tasks with concurrent.futures
body: <p>I am trying to do parallel tasks in a Jupyter notebook. Hoping someone can tell me what should I do or what should I learn. </p>
  
  <p>In my Jupyter notebook, I would loop through an argument from 1 to 10 which passed to another py script. What I want is to let my computer do each argument with one single task. I believe, with that, I would expedite the efficiency.</p>
  
  <p>Here is what I have in my Jupyter notebook:</p>
  
  <pre><code>import os
  from time import time
  start_1 = time()
  # parameters
  file = 'Tool_1.py' # the single py script which I would run in a single loop
  file_1 = 'my_data.csv'
  skiprows = 4
  stop_loss_point_init = -50
  stop_gain_point = 800
  move_step = 100
  move_far = 50 
  # loop body
  for window in range(1, 11): # I would loop window from 1 to 10
      start_2 = time()
      cmd = 'python %s %s %d %d %d %d %d %d' % (file,file_1,skiprows,window,stop_loss_point_init,stop_gain_point,move_step,move_far)
      print('Running '+str(cmd))
      os.system(cmd)
      output_file = 'output_file.csv'
      end_2 = time()
      print(output_file)
      print("Exported in {:.2f} minutes.".format((end_2 - start_2)/60))
  
  end_1 = time()
  print("Completed in {:.2f} minutes.".format((end_1 - start_1)/60))
  </code></pre>