Re: [Matplotlib-users] using strpdate2num in load

2007-12-18 Thread Lionel Roubeyrie
Hi Emmanuel,
look at dateutil.parser.parse, there is exactly what you search.

Le mardi 18 décembre 2007, Emmanuel a écrit :
 Ok, thank you!

 I'm missing an option to (easily) use date that start with the day
 day/month/year (it is the case in Brazil and France for example)

 I'm using something like tha
 date_Ymd=%s/%s/%s % (datedayfirst.split('/')[2],datedayfirst.split
 ('/')[1],datedayfirst.split ('/')[0])

 I was lookigng for sometinh like that :

 datestr2num(a,dayfirst=True)
 or
 datestr2num(a,fmt=%d/%m/%Y)

 On Dec 11, 2007 11:16 AM, John Hunter [EMAIL PROTECTED] wrote:
  On Dec 11, 2007 6:00 AM, Emmanuel [EMAIL PROTECTED] wrote:
   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 :
 
  Try stripping the double quote characters from you file.
 
  JDH
 
  -
  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



-- 
Lionel Roubeyrie - [EMAIL PROTECTED]
Chargé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr


-
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://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] using strpdate2num in load

2007-12-18 Thread Emmanuel
Yes, I think strpdate2num is based on dateutil.parser.parse thast's why I
tried dayfirst=True which is used with dateutil.parser.parse.


It would be funny if from a list of string, it could be automatically try to
decide between day/month/year, month/day/year format... (it´s a joke)
-
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://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] using strpdate2num in load

2007-12-17 Thread Emmanuel
Ok, thank you!

I'm missing an option to (easily) use date that start with the day
day/month/year (it is the case in Brazil and France for example)

I'm using something like tha
date_Ymd=%s/%s/%s % (datedayfirst.split('/')[2],datedayfirst.split
('/')[1],datedayfirst.split ('/')[0])

I was lookigng for sometinh like that :

datestr2num(a,dayfirst=True)
or
datestr2num(a,fmt=%d/%m/%Y)

On Dec 11, 2007 11:16 AM, John Hunter [EMAIL PROTECTED] wrote:

 On Dec 11, 2007 6:00 AM, Emmanuel [EMAIL PROTECTED] wrote:
  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 :

 Try stripping the double quote characters from you file.

 JDH

 -
 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

-
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://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] using strpdate2num in load

2007-12-11 Thread Emmanuel
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.ValueErrorTraceback (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)
182return 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


Re: [Matplotlib-users] using strpdate2num in load

2007-12-11 Thread John Hunter
On Dec 11, 2007 6:00 AM, Emmanuel [EMAIL PROTECTED] wrote:
 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 :

Try stripping the double quote characters from you file.

JDH

-
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