-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: optional ':' separator in ISO8601 strings #12483
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
62ff4a2
to
18cb9b5
Compare
'6-2014': datetime.datetime(2014, 6, 1), | ||
|
||
'20010101 12': datetime.datetime(2001, 1, 1, 12), | ||
'20010101 1234': datetime.datetime(2001, 1, 1, 12, 34), |
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.
hmm, I don't think 12
or 1234
should work (but 123456
) should , IOW, you either have to fully specify HHMMSS or not at all. Any ambiuity in partially accepting it as you have here?
cc @chris-b1
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.
So the current version accepts 12
in addition to 1
. I was thinking we should keep the two digit form.
In [23]: pd.Timestamp('20010101 1')
Out[23]: Timestamp('2001-01-01 01:00:00')
In [24]: pd.Timestamp('20010101 09')
Out[24]: Timestamp('2001-01-01 09:00:00')
In [25]: pd.Timestamp('20010101 12')
Out[25]: Timestamp('2001-01-01 12:00:00')
As for four digits, I was thinking it would make sense to allow "military" times like 0800
(which is also currently accepted).
In [26]: pd.Timestamp('20010101 0800')
Out[26]: Timestamp('2001-01-01 08:00:00')
9d7911c
to
dc7e372
Compare
cc @chris-b1 can you have a look |
Looks good as far as I can tell. The partial time formats are a bit out there, but unambiguous, so I don't see any harm. In [24]: pd.Timestamp('2015/01/01 1234')
Out[24]: Timestamp('2015-01-01 12:34:00') |
@@ -43,3 +43,10 @@ Performance Improvements | |||
|
|||
Bug Fixes | |||
~~~~~~~~~ | |||
|
|||
- Timestamps without ':' in HHMMSS keep microsecond resolution | |||
|
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.
just do this in a 1-liner, pls add the issue number, and move to 0.18.0
can you rebase and push again |
Allows Timestamps constructed from strings without the ':' separator in HHMMSS to preserve microsecond resolution.
thanks @thejohnfreeman ! |
Thanks for the help! |
I normally test on windows before merging....but alas
|
so if you have the ability to debug on windows, pls have a look :< |
Just at a glance, the errors make it seem like my changes to the C code weren't built. I didn't have any platform-specific preprocessor guards in the C, so I would expect it to behave the same on each platform. What are the sources of differences between Windows and Linux behavior? Are the numpy and Python datetime types different on each platform? Are there platform-specific tests? |
hmm, I just tested this again on windows and its ok. Why don't you rebase and push again. |
ok, maybe something funny happened in the build. thanks again! |
git diff upstream/master | flake8 --diff
Includes some refactoring in the ISO8601 parser. If more tests are desired, please let me know where to put them. Same for the whatsnew entry. This is effectively my first pull request for Pandas.
cc @jreback