title: KeyError: '[] not in index' when renaming pandas columns by index assignment
body: <p>I'm trying to rename a column and then use it, but I get the error <code>KeyError: '[] not in index'</code>.</p>
  <p>What do I need to change and why?</p>
  <pre><code>import pandas as pd
  
  url = 'https://github.com/hadley/tidy-data/blob/master/data/billboard.csv'
  
  tracks = pd.read_csv(url, encoding='latin1')
  
  tracks.head()
  
  tracks.columns.values[1]
  
  tracks.columns.values[1] = &quot;artist&quot;
  
  tracks.head()
  
  tracks2 = tracks[['year', 'artist', 'track', 'time']]
  tracks2.head()
  </code></pre>
  <h2>Traceback</h2>
  <pre class="lang-py prettyprint-override"><code>Traceback (most recent call last):
    File &quot;E:\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py&quot;, line 3418, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File &quot;&lt;ipython-input-2-ed116e277ed9&gt;&quot;, line 1, in &lt;module&gt;
      runfile('E:/PythonProjects/stack_overflow/test/test8.py', wdir='E:/PythonProjects/stack_overflow/test')
    File &quot;E:\Program Files\JetBrains\PyCharm 2020.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py&quot;, line 197, in runfile
      pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
    File &quot;E:\Program Files\JetBrains\PyCharm 2020.1\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py&quot;, line 18, in execfile
      exec(compile(contents+&quot;\n&quot;, file, 'exec'), glob, loc)
    File &quot;E:/PythonProjects/stack_overflow/test/test8.py&quot;, line 15, in &lt;module&gt;
      tracks2 = tracks[['year', 'artist', 'track', 'time']]
    File &quot;E:\Anaconda3\lib\site-packages\pandas\core\frame.py&quot;, line 3030, in __getitem__
      indexer = self.loc._get_listlike_indexer(key, axis=1, raise_missing=True)[1]
    File &quot;E:\Anaconda3\lib\site-packages\pandas\core\indexing.py&quot;, line 1266, in _get_listlike_indexer
      self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing)
    File &quot;E:\Anaconda3\lib\site-packages\pandas\core\indexing.py&quot;, line 1316, in _validate_read_indexer
      raise KeyError(f&quot;{not_found} not in index&quot;)
  KeyError: '[] not in index'
  </code></pre>
  <h2>Test Data</h2>
  <pre class="lang-py prettyprint-override"><code>year,artist.inverted,track,time,genre,date.entered
  2000,Destiny's Child,Independent Women Part I,3:38,Rock,2000-09-23
  2000,Santana,&quot;Maria, Maria&quot;,4:18,Rock,2000-02-12
  2000,Savage Garden,I Knew I Loved You,4:07,Rock,1999-10-23
  2000,Madonna,Music,3:45,Rock,2000-08-12
  2000,&quot;Aguilera, Christina&quot;,Come On Over Baby (All I Want Is You),3:38,Rock,2000-08-05
  </code></pre>