title: python matplotlib plot datetime index
body: <p>I am trying to create a simple line graph based on a datetime index. But I get an error message. </p>
  
  <pre><code>#standard packages
  import numpy as np
  import pandas as pd
  
  #visualization
  %matplotlib inline
  import matplotlib.pylab as plt
  
  #create weekly datetime index
  edf = pd.read_csv('C:\Users\j~\raw.csv', parse_dates=[6])
  edf2 = edf[['DATESENT','Sales','Traffic']].copy()
  edf2['DATESENT']=pd.to_datetime(edf2['DATESENT'],format='%m/%d/%Y')
  edf2 = edf2.set_index(pd.DatetimeIndex(edf2['DATESENT']))
  edf2.resample('w').sum()
  edf2
  
  #output
  
              SALES
  DATESENT     
  2014-01-05  476
  2014-01-12  67876
  </code></pre>
  
  <p>Then I try to plot (the simplest line plot possible to see sales by week) </p>
  
  <pre><code>#linegraph
  edf3.plot(x='DATESENT',y='Sales')
  </code></pre>
  
  <p>But I get this error message </p>
  
  <blockquote>
    <p>KeyError: 'DATESENT'</p>
  </blockquote>