title: Python Pandas error
body: <p>First of all, hello everyone. I'm currently working on a project and my main objective is to get some addresses from a csv file, calculate the percentage of similarity that those addresses have with a trusted database and return that value. 
  I have a code that is working however, when i try to calculate the similar rate,  i get an error with the "write to csv" function. The code only runs one line and then it crashes. The error starts occurring after line 30. Thanks in advance for your help and have a nice day.</p>
  
  <p>Full code: <a href="https://pastebin.com/4sJZJtY9" rel="nofollow noreferrer">https://pastebin.com/4sJZJtY9</a></p>
  
  <p>Error: </p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\anaconda\lib\site-packages\pandas\core\indexes\base.py", line 2393, in get_loc
      return self._engine.get_loc(key)
    File "pandas\_libs\index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc (pandas\_libs\index.c:5239)
    File "pandas\_libs\index.pyx", line 154, in pandas._libs.index.IndexEngine.get_loc (pandas\_libs\index.c:5085)
    File "pandas\_libs\hashtable_class_helper.pxi", line 1207, in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas\_libs\hashtable.c:20405)
    File "pandas\_libs\hashtable_class_helper.pxi", line 1215, in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas\_libs\hashtable.c:20359)
  KeyError: 1
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File ".\Teste.py", line 74, in &lt;module&gt;
      cp4[1].to_csv('AI.csv')
    File "C:\anaconda\lib\site-packages\pandas\core\frame.py", line 2062, in __getitem__
      return self._getitem_column(key)
    File "C:\anaconda\lib\site-packages\pandas\core\frame.py", line 2069, in _getitem_column
      return self._get_item_cache(key)
    File "C:\anaconda\lib\site-packages\pandas\core\generic.py", line 1534, in _get_item_cache
      values = self._data.get(item)
    File "C:\anaconda\lib\site-packages\pandas\core\internals.py", line 3590, in get
      loc = self.items.get_loc(item)
    File "C:\anaconda\lib\site-packages\pandas\core\indexes\base.py", line 2395, in get_loc
      return self._engine.get_loc(self._maybe_cast_indexer(key))
    File "pandas\_libs\index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc (pandas\_libs\index.c:5239)
    File "pandas\_libs\index.pyx", line 154, in pandas._libs.index.IndexEngine.get_loc (pandas\_libs\index.c:5085)
    File "pandas\_libs\hashtable_class_helper.pxi", line 1207, in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas\_libs\hashtable.c:20405)
    File "pandas\_libs\hashtable_class_helper.pxi", line 1215, in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas\_libs\hashtable.c:20359)
  KeyError: 1
  </code></pre>