title: How to append result of multiprocessing Pool based on index from input list in Python?
body: <p>Overall, my script is taking an input of:</p>
  
  <ol>
  <li>Address Search Query</li>
  <li>Lat/Lon Coordinates</li>
  </ol>
  
  <p>What I need to do is call geocoding API to get response for each address in the query list, parse the XML response to get the information I need, and check if the newly returned point matches the point on file.</p>
  
  <p>I have this set up working fine until I tried to use the multiprocessing function in Python to help speed up the task.</p>
  
  <p>When using multiprocessing, I can get a final result but the issue that arises is from the random ordering of processing, the multiprocessing result I receive is not matched up with the correct input query.</p>
  
  <p>e.g. "123 Main Street" result appends to "431 Main Street" and "431 Main Street" has result appending to "123 Main Street"</p>
  
  <p>My question is:
  <strong>How do I get the multiprocessing result to append to the correct query rather than appending based on the order of processing?</strong></p>
  
  <p>I am using Pandas Data Frame to keep track of the data. </p>
  
  <p>Portion related:</p>
  
  <pre><code>    def apiRequest(query):
          url = 'URL goes here'
          parameters = {'q':query,'other parameters are here'}
          request = requests.get(url,params=parameters) 
          result = ET.fromstring(request.text)
      return(result)
  
      results = pool.map(apiRequest,queryList)
  
      #This is where I append the result where order is based on multiprocessing result list
      i=0
      for result in results:
          df.loc[result[i],'Result Text'] = result
          i=i+1  
  </code></pre>
  
  <p>Edit: Linked thread is very similar but not exactly what I needed. I found out from comment below that multiprocessing list does return in order of input list not order of processing. With this information I realized I just needed to reference the index of the response. I did this using the enumerate function in the attached thread, so it was helpful. </p>
  
  <p>Another issue unrelated now.. it seems the multiprocessing just isn't  working. Takes double the time it was taking before. Fix one issue and another arises!</p>
  
  <p>Thanks for the help!</p>