title: Plotting Pandas DataFrames as single days on the x-axis in Python/Matplotlib
body: <p>I've got data like this:</p>
  
  <pre><code>    col1  ;col2
  2001-01-01;1
  2001-01-01;2
  2001-01-02;3
  2001-01-03;4
  2001-01-03;2
  2001-01-04;2
  </code></pre>
  
  <p>I'm reading it in Python/Pandas using <code>pd.read_csv(...)</code> into a DataFrame.
  Now I want to plot col2 on the y-axis and col1 on the x-axis day-wise. I searched a lot but couldn't too many very useful pages describing this in detail. I found that matplotlib does currently NOT support the dataformat in which the dates are stored in (datetime64).</p>
  
  <p>I tried converting it like this:</p>
  
  <pre><code>fig, ax = plt.subplots()
  X = np.asarray(df['col1']).astype(DT.datetime)
  xfmt = mdates.DateFormatter('%b %d')
  ax.xaxis.set_major_formatter(xfmt)
  ax.plot(X, df['col2'])
  plt.show()
  </code></pre>
  
  <p>but this does NOT work.
  What is the best way? 
  I can only find bits there and bits there, but nothing really working in complete and more importantly, up-to-date ressources related to this functionality for the latest version of pandas/numpy/matplotlib.</p>
  
  <p>I'd also be interested to convert this absolut dates to consecutive day-indices, i.e:
  The starting day <em>2001-01-01</em> is Day <strong>1</strong>, thus the data would look like this:</p>
  
  <pre><code>    col1  ;col2 ; col3
  2001-01-01;1;1
  2001-01-01;2;1
  2001-01-02;3;2
  2001-01-03;4;3
  2001-01-03;2;3
  2001-01-04;2;4
  .....
  2001-02-01;2;32
  </code></pre>
  
  <p>Thank you very much in advance.</p>