title: KeyError 'City' in Dataframe when Calculating Value?
body: <p>I've been having some trouble working with a dataframe in Python for the past couple of days - I've been trying to calculate the coordinate values for a 'City' Column in my dataframe (it has around 10500 rows, however I always receive a KeyError: 'City' when I try to run any functions on that column. </p>
  
  <h2>Background</h2>
  
  <p>I've been inputting a .csv file which contains around 10500 rows x 15 columns and converting it to a dataframe. I'm then adding an additional column at the end called 'Coordinates' to hold the coordinate values of the 'City' column. </p>
  
  <pre><code>#inserting my .csv file to convert to a dataframe
  df = pd.read_csv("/path/to/test.csv")
  
  #creating new column 'Coordinates' to insert into dataframe at the end
  df['Coordinates'] = '0,0'
  
  # practice location finding using geopy
  geolocator = Nominatim(timeout =10)
  
  #method to calculate latitude and longitude
  def eval_results(x):
  try:
      return (x.latitude, x.longitude)
  except:
      return (None, None)
  
  #calculating the coordinates value by running the following methods on the 'City' column
  df['Coordinates'] = df['City'].apply(geolocator.geocode,
  timeout=1000000).apply(lambda x: eval_results(x))
  </code></pre>
  
  <h2>Error</h2>
  
  <p>However, when I run the code, I receive the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "metadata-geo.py", line 27, in &lt;module&gt;
  metadata_df['Coordinates'] = metadata_df['City'].apply(geolocator.geocode,timeout=1000000).apply(lambda x: eval_results(x))
    File "/usr/local/lib/python2.7/site-packages/pandas/core/frame.py", line 2688, in __getitem__
  return self._getitem_column(key)
    File "/usr/local/lib/python2.7/site-packages/pandas/core/frame.py", line 2695, in _getitem_column
  return self._get_item_cache(key)
    File "/usr/local/lib/python2.7/site-packages/pandas/core/generic.py", line 2489, in _get_item_cache
  values = self._data.get(item)
    File "/usr/local/lib/python2.7/site-packages/pandas/core/internals.py", line 4115, in get
  loc = self.items.get_loc(item)
    File "/usr/local/lib/python2.7/site-packages/pandas/core/indexes/base.py", line 3080, in get_loc
  return self._engine.get_loc(self._maybe_cast_indexer(key))
    File "pandas/_libs/index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc
    File "pandas/_libs/index.pyx", line 162, in pandas._libs.index.IndexEngine.get_loc
    File "pandas/_libs/hashtable_class_helper.pxi", line 1492, in pandas._libs.hashtable.PyObjectHashTable.get_item
    File "pandas/_libs/hashtable_class_helper.pxi", line 1500, in pandas._libs.hashtable.PyObjectHashTable.get_item
  KeyError: 'City'
  </code></pre>
  
  <p>I'm not entirely sure what the error is, and I've been going through a lot of posts concerning KeyErrors, but none of them seem to apply to my situation.</p>