title: pass over errors with for loops and fill in row with None
body: <p>i am using a for loop to iterate over rows in a data frame and apply a function to values in two of the columns to get coordinates from a city name using geopy. Some of the values throw errors and i want to use a try / except (or catch?) inside the for loop so that in the case that applying geopy to one of the values throws an error, python just fills in that row with 'None' and then i can go back and delete those rows with 'None'. is there a way to do that? here is the code i am working with:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>list_lat = []   # create empty list for lat
  list_long = [] # create empty list for long
  
  for index, row in df.iterrows(): # iterate over rows in dataframe
      try:
          City = row['City Name']
          State = row['State Name']       
          query = str(City)+','+str(State)
  
          location = geolocator.geocode(query)
          lat = location.latitude
          long = location.longitude
          #print(lat, long) #testing purposes
  
          list_lat.append(lat)
          list_long.append(long)
      
      
      except Exception as e:
          
  #         lat = 'None'
  #         long = 'None'</code></pre>
  </div>
  </div>
  </p>