Hi, I've a little problem with date conversion. I have a csv file which looks like : "Data","Valor" "15/01/2007"," 6,700012000" "12/01/2007"," 6,659903000" "11/01/2007"," 6,701586000"
I try to get date using function strpdate2num in load doing this : from pylab import datestr2num, load def comma_nb2float(A): return eval(A.replace(',','.')) dates, valor = load("file.csv",delimiter=',',converters={0:strpdate2num('%d/%m/%Y'),1:comma_nb2float},skiprows=1, usecols=(0,1),unpack=True) I got the following error message : --------------------------------------------------------------------------- exceptions.ValueError Traceback (most recent call last) /home/manu/Documents/Perso/....../<ipython console> /usr/lib/python2.4/site-packages/matplotlib/mlab.py in load(fname, comments, delimiter, converters, skiprows, usecols, unpack) 1353 if usecols is not None: 1354 vals = line.split(delimiter) -> 1355 row = [converterseq[j](vals[j]) for j in usecols] 1356 else: 1357 row = [converterseq[j](val) for j,val in enumerate(line.split(delimiter))] /usr/lib/python2.4/site-packages/matplotlib/dates.py in __call__(self, s) 182 return value: a date2num float 183 """ --> 184 return date2num(datetime.datetime(*time.strptime(s, self.fmt) [:6])) 185 186 def datestr2num(d): /usr/lib/python2.4/_strptime.py in strptime(data_string, format) 291 found = format_regex.match(data_string) 292 if not found: --> 293 raise ValueError("time data did not match format: data=%s fmt=%s" % 294 (data_string, format)) 295 if len(data_string) != found.end(): ValueError: time data did not match format: data="15/01/2007" fmt=%d/%m/%Y I didn't understood the problem, anyone can help me ? ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users