On 25.04.2014 11:02, Mark Bakker wrote:
> OK, I figured out I can use:
> converters={0:strpdate2num('%d-%m-%y')}
> 
> What now if part of my dates are given as 'day-month-year' and part as
> 'day/month/year' in the same file (I know, who does that, an I could do
> a replace first and then read it in). Can I specify both formats for the
> converter? I guess not....

Try this:

   def _conv_date(s):
       try:
           return strpdate2num('%d-%m-%y')
       except Exception:   # figure out which exception class to use
           return strpdate2num('%d/%m/%y')

   converters={0:_conv_date}

Cheers, Andreas.


> 
> Thanks,
> 
> Mark
> 
> 
> 
> On Fri, Apr 25, 2014 at 10:46 AM, Mark Bakker <mark...@gmail.com
> <mailto:mark...@gmail.com>> wrote:
> 
>     Hello List,
> 
>     datestr2num works great when dates are stored as month/day/year (as
>     American like).
> 
>     Europeans store them as day/month/year.
> 
>     Any quick function to convert a day/month/year string do a date? Is
>     there an eu version: datestr2numeu?
> 
>     Thanks,
> 
>     Mark
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> 
> 
> 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 


-- 
-- Andreas.

------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to