title: Python: "The label is not in the columns" error after pd.read_csv(..., index_col='year')
body: <p>I am trying to access a column in my data frame however it's not working</p>
  
  <pre><code>import pandas as pd
  df = pd.read_csv(data, index_col='year')
  dfyear = df.loc[:,'year']
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>KeyError: 'the label [year] is not in the [columns]'
  </code></pre>
  
  <p>How do I fix this? </p>