Re: [Matplotlib-users] datestr2num for day/month/year

2014-04-25 Thread Paul Hobson
You might have more luck reading in that data (dates with mixed format) with pandas than numpy. On Fri, Apr 25, 2014 at 2:37 AM, Mark Bakker wrote: > Thanks, Andreas, but it doesn't quite work. > > This works for me (I manually changed all dates to 'day-month-year' for > testing): > > a = load

Re: [Matplotlib-users] datestr2num for day/month/year

2014-04-25 Thread Mark Bakker
Thanks, Andreas, but it doesn't quite work. This works for me (I manually changed all dates to 'day-month-year' for testing): a = loadtxt('test.csv',converters={2:strpdate2num('%d-%m-%Y')}) But when I define the same function in a separate function, as you suggested: def conv_date(s): retu

Re: [Matplotlib-users] datestr2num for day/month/year

2014-04-25 Thread Andreas Hilboll
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 i

Re: [Matplotlib-users] datestr2num for day/month/year

2014-04-25 Thread Mark Bakker
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

[Matplotlib-users] datestr2num for day/month/year

2014-04-25 Thread Mark Bakker
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 -