From: Stephen W. <ste...@cs...> - 2005-01-23 03:50:15
|
John Hunter wrote: >>>>>>"Stephen" == Stephen Walton <ste...@cs...> writes: >>>>>> >>>>>> > > Stephen> I need a function which will take an N by 3 or N by 6 > Stephen> array... and convert them to matplotlib > Stephen> dates. > > > from datetime import datetime > from pylab import date2num > x = ...your array > dts = date2num([ datetime(y,m,d) for y,m,d in x ]) > > > This works fine, John, as do your other ideas as well. >FYI, date2num is found in matplotlib.dates. I'll take a look at the >matlab datenum docstring in matlab and see about including this >functionality in the matplotlib.dates version. > > No need. The functionality is already there and I need to begin "thinking in Python." Using tuple unpacking on rows of an array did not occur to me, I admit. Steve |