Skip to content

dayfirst non working when constructing a pd.DatetimeIndex with an array #5917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gbakalian opened this issue Jan 13, 2014 · 3 comments · Fixed by #7038
Closed

dayfirst non working when constructing a pd.DatetimeIndex with an array #5917

gbakalian opened this issue Jan 13, 2014 · 3 comments · Fixed by #7038
Labels
Bug Datetime Datetime data dtype
Milestone

Comments

@gbakalian
Copy link

assert pd.DatetimeIndex(['10/02/2014'], dayfirst=True) == pd.DatetimeIndex(np.asarray(['10/02/2014'], dtype=object), dayfirst=True)

@jreback
Copy link
Contributor

jreback commented Jan 13, 2014

this is a known bug, see here: #3341

@jreback jreback closed this as completed Jan 13, 2014
@jorisvandenbossche
Copy link
Member

@jreback I think this is another issue:

In [5]: pd.to_datetime(['10/02/2014'], dayfirst=True)[0]
Out[5]: Timestamp('2014-02-10 00:00:00', tz=None)

In [6]: pd.to_datetime(np.asarray(['10/02/2014'], dtype='object'), dayfirst=True)[0]
Out[6]: Timestamp('2014-02-10 00:00:00', tz=None)

In [8]: pd.DatetimeIndex(np.asarray(['10/02/2014'], dtype='object'), dayfirst=True)[0]
Out[8]: Timestamp('2014-10-02 00:00:00', tz=None)

There seems to be a difference between to_datetime and DatetimeIndex.
Also, the other issue is about dayfirst not being strict, so no error for eg "10/14/2014". While here, it is just wrong even in a case that is perfectly possible for dayfirst.

@jreback
Copy link
Contributor

jreback commented Jan 14, 2014

@jorisvandenbossche I agree dayfirst is non-strict / wrong because dateutil is broken IIRC

I had closed this because it is a dupe of #3341 but not prob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants