Skip to content

Commit

Permalink
Add dateutil kwargs to csv2rec
Browse files Browse the repository at this point in the history
Fixes ambiguous date problems between US/UK date conventions.
  • Loading branch information
dmcdougall committed Sep 6, 2012
1 parent dffbad1 commit b096c81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/matplotlib/mlab.py
Expand Up @@ -2090,7 +2090,7 @@ def extract(r):

def csv2rec(fname, comments='#', skiprows=0, checkrows=0, delimiter=',',
converterd=None, names=None, missing='', missingd=None,
use_mrecords=False):
use_mrecords=False, dayfirst=False, yearfirst=False):
"""
Load data from comma/space/tab delimited file in *fname* into a
numpy record array and return the record array.
Expand Down Expand Up @@ -2216,7 +2216,7 @@ def mybool(x):

def mydate(x):
# try and return a date object
d = dateparser(x)
d = dateparser(x, dayfirst=dayfirst, yearfirst=yearfirst)

if d.hour>0 or d.minute>0 or d.second>0:
raise ValueError('not a date')
Expand Down

0 comments on commit b096c81

Please sign in to comment.