Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b096c81

Browse files
committed
Add dateutil kwargs to csv2rec
Fixes ambiguous date problems between US/UK date conventions.
1 parent dffbad1 commit b096c81

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/matplotlib/mlab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,7 +2090,7 @@ def extract(r):
20902090

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

22172217
def mydate(x):
22182218
# try and return a date object
2219-
d = dateparser(x)
2219+
d = dateparser(x, dayfirst=dayfirst, yearfirst=yearfirst)
22202220

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

0 commit comments

Comments
 (0)