title: date2num , ValueError: ordinal must be >= 1
body: <p>I'm using the matplotlib candlestick module which requires the time to be passed as a float day format . I`m using date2num to convert it, before :</p>
  
  <p>This is my code :</p>
  
  <pre><code>import csv
  import sys
  import math
  import numpy as np
  import datetime
  from optparse import OptionParser
  import matplotlib.pyplot as plt
  import matplotlib.cbook as cbook
  import matplotlib.mlab as mlab
  import matplotlib.dates as mdates
  from matplotlib.finance import candlestick
  from matplotlib.dates import date2num
  
  datafile = 'historical_data/AUD_Q10_1D_500.csv'
  print 'loading', datafile
  r = mlab.csv2rec(datafile, delimiter=';')
  quotes = [date2num(r['date']),r['open'],r['close'],r['max'],r['min']]
  
  
  candlestick(ax, quotes, width=0.6)
  
  plt.show()
  </code></pre>
  
  <p><em>( here is the csv file : <a href="http://db.tt/MIOqFA0" rel="noreferrer">http://db.tt/MIOqFA0</a> )</em></p>
  
  <p>This is what the doc says :</p>
  
  <blockquote>
    <p>candlestick(ax, quotes,
    width=0.20000000000000001,
    colorup='k', colordown='r', alpha=1.0)
    quotes is a list of (time, open,
    close, high, low, ...)  tuples.  As
    long as the first 5 elements of the
    tuples are these values,  the tuple
    can be as long as you want (eg it may
    store volume).
        time must be in float days format - see date2num</p>
  </blockquote>
  
  <p>Here is the full error log :</p>
  
  <pre><code>Traceback (most recent call last):
  File
  "/usr/lib/python2.6/site-packages/matplotlib/backends/backend_qt4agg.py",
  line 83, in paintEvent
  FigureCanvasAgg.draw(self) File
  "/usr/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py",
  line 394, in draw
  self.figure.draw(self.renderer) File
  "/usr/lib/python2.6/site-packages/matplotlib/artist.py",
  line 55, in draw_wrapper draw(artist,
  renderer, *args, **kwargs) File
  "/usr/lib/python2.6/site-packages/matplotlib/figure.py",
  line 798, in draw func(*args) File
  "/usr/lib/python2.6/site-packages/matplotlib/artist.py",
  line 55, in draw_wrapper draw(artist,
  renderer, *args, **kwargs) File
  "/usr/lib/python2.6/site-packages/matplotlib/axes.py", line 1946, in draw a.draw(renderer)
  File
  "/usr/lib/python2.6/site-packages/matplotlib/artist.py",
  line 55, in draw_wrapper draw(artist,
  renderer, *args, **kwargs) File
  "/usr/lib/python2.6/site-packages/matplotlib/axis.py", line 971, in draw tick_tups = [ t for
  t in self.iter_ticks()] File
  "/usr/lib/python2.6/site-packages/matplotlib/axis.py", line 904, in iter_ticks majorLocs =
  self.major.locator() File
  "/usr/lib/python2.6/site-packages/matplotlib/dates.py",
  line 743, in __call__ self.refresh()
  File
  "/usr/lib/python2.6/site-packages/matplotlib/dates.py",
  line 752, in refresh dmin, dmax =
  self.viewlim_to_dt() File
  "/usr/lib/python2.6/site-packages/matplotlib/dates.py",
  line 524, in viewlim_to_dt return
  num2date(vmin, self.tz),
  num2date(vmax, self.tz) File
  "/usr/lib/python2.6/site-packages/matplotlib/dates.py",
  line 289, in num2date if not
  cbook.iterable(x): return
  _from_ordinalf(x, tz) File "/usr/lib/python2.6/site-packages/matplotlib/dates.py",
  line 203, in _from_ordinalf dt =
  datetime.datetime.fromordinal(ix)
  ValueError: ordinal must be &gt;= 1
  </code></pre>
  
  <p>If I run a quick : </p>
  
  <pre><code>for x in r['date']:
      print str(x) + "is :" + str(date2num(x))
  </code></pre>
  
  <p>it outputs something like : </p>
  
  <pre><code>2010-06-12is :733935.0
  2010-07-12is :733965.0
  2010-08-12is :733996.0
  </code></pre>
  
  <p>which sound ok to me :)</p>