Skip to content

WIP/ENH: Pass tzinfos to dateutil parser #24104

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
wants to merge 2 commits into from

Conversation

jbrockmendel
Copy link
Member

Putting this up early because the set_option behavior deserves discussion. The alternative is to make/let users pass tzinfos in Timestamp, to_datetime, DatetimeIndex, and probably others.

Still need to:

@pep8speaks
Copy link

Hello @jbrockmendel! Thanks for submitting the PR.

@jreback
Copy link
Contributor

jreback commented Dec 5, 2018

huh? what is this supposed to accomplish from a user POV ?

@jbrockmendel
Copy link
Member Author

huh? what is this supposed to accomplish from a user POV ?

At the moment we aren't correctly parsing any timezones aside from UTC offsets.

>>> ts = pd.Timestamp("2018-11-04 3:45 PM CST")
/usr/lib/python2.7/site-packages/dateutil/parser/_parser.py:1204: UnknownTimezoneWarning: tzname CST identified but not understood.  Pass `tzinfos` argument in order to correctly return a timezone-aware datetime.  In a future version, this will raise an exception.
  category=UnknownTimezoneWarning)
>>> 
>>> ts
Timestamp('2018-11-04 15:45:00')

(yes, yes, I know "CST" isn't a timezone. But PST, CST, EST, ... are not uncommon in the wild)

@jreback
Copy link
Contributor

jreback commented Dec 5, 2018

that’s not my point

how is this actually useful?

@jbrockmendel
Copy link
Member Author

how is this actually useful?

Because it allows users to parse date-like strings correctly. Because at the moment we are silently returning incorrect results (well, dateutil is issuing a warning). Because before long dateutil will start raising in these cases and we should provide some way of letting users pass a tzinfos dict.

@jreback
Copy link
Contributor

jreback commented Dec 5, 2018

this is a really tiny edge case and adds lots of complexity

@jbrockmendel
Copy link
Member Author

I agree that this adds complexity, but not that it is a tiny corner case. Let's put this on the back-burner until after 0.24.0.

@jreback
Copy link
Contributor

jreback commented Dec 5, 2018

ok, prob best to close this. and simply create a project for those issues.

@gfyoung gfyoung added Datetime Datetime data dtype Timezones Timezone data dtype labels Dec 6, 2018
@jbrockmendel
Copy link
Member Author

Closing until after 0.24.0

@jbrockmendel jbrockmendel deleted the tzinfos branch April 5, 2020 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect tzinfo check in tslibs.parsing
4 participants