title: How do i append coordinates to a csv containing State names in python in less time
body: <p>I have a working code which does the job using opencage API but takes significantly longer time. How can i implement the same in less time.
  The df contains a list of all cities of the world
  this code sections iterates through all the city names and appends their coordintes</p>
  
  <p>link to my <a href="https://drive.google.com/drive/folders/1H5k9rw0rJdb5lSf3RIxefatY346AX951?usp=sharing" rel="nofollow noreferrer">code and csv file</a></p>
  
  <p><a href="https://i.stack.imgur.com/fiCd3.png" rel="nofollow noreferrer">image</a></p>
  
  <pre><code>key = 'KEY'  # get Your api key from:  https://opencagedata.com
  geocoder = OpenCageGeocode(key)
  
  list_lat = []   
  list_long = []
  
  for index, row in df.iterrows():
  
      State = row['city_ascii']       
      query = str(State)
  
      results = geocoder.geocode(query)   
      lat = results[0]['geometry']['lat']
      long = results[0]['geometry']['lng']
  
      list_lat.append(lat)
      list_long.append(long)
  
  df['lat'] = list_lat   
  df['lon'] = list_long
  
  df.head()
  </code></pre>