-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Timestamp cannot parse nanosecond from string #7907
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
Conversation
obj.value = pandas_datetimestruct_to_datetime(PANDAS_FR_ns, &obj.dts) | ||
_check_dts_bounds(&obj.dts) | ||
if out_tzoffset != -1: | ||
obj.tzinfo = pytz.FixedOffset(out_tzoffset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which is preferable for fixed offset, pytz.FixedOffset
or dateutil.tz.tzoffset
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create a pytz ; dateutil must be explicitly specified (in theory could have an option for this but will defer that to the future - you can create an issue if u would like - pls copy @dbew on it)
@sinhrks can you run a perf test and post if anything amiss (I don't think so, but just to be sure) |
As the original one gets little slower, modified the logic a little. Following is a perf before/after the modification. Looks varied, but no test gets constantly worse. Perf with original logic in this PR (for ref)
1st run with current logic
2nd run
|
lookw ok to me cc @ischwabacher can you give a once over pls |
This is kind of difficult to go through. The tests look okay to me...cannot comment on the specific changes, though. |
@@ -399,7 +401,8 @@ Bug Fixes | |||
- Bug in ``Series.str.cat`` with an index which was filtered as to not include the first item (:issue:`7857`) | |||
|
|||
|
|||
|
|||
- Bug in ``Timestamp`` cannot parse ``nanosecond`` from string (:issue:`7878`) | |||
- Bug in ``Timestamp`` with string offset and ``tz`` results in incorrect (:issue:`7833`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean to say just incorrect, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, should be more specific, or grammatically wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was just a minor grammar point
just say incorrect (not in incorrect)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed.
ok ping in green |
@jreback Yep, now green. |
BUG: Timestamp cannot parse nanosecond from string
thanks! |
Fixes 2 problems related to
Timestamp
string parsing:Timestamp
parsing results incorrect if input contains offset string (Closes BUG: Constructing Timestamp from local time + offset + time zone yields wrong offset #7833).NOTE: Also modified
Timestamp.__repr__
to display fixed timezone info, because this can be eitherpytz
ordateutil
.Timestamp
losesnanosecond
info when parsing fromstr
. (Closes Timestamp losing nanosecond accuracy when reading from string #7878)CC @cyber42 @ischwabacher @rockg @adamgreenhall