-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Change DatetimeIndex.time to also return timezone info #21865
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
ENH: Change DatetimeIndex.time to also return timezone info #21865
Conversation
Hello @jquinon! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on July 11, 2018 at 20:57 Hours UTC |
doc/source/whatsnew/v0.24.0.txt
Outdated
@@ -84,7 +84,7 @@ Other Enhancements | |||
- :meth:`Series.nlargest`, :meth:`Series.nsmallest`, :meth:`DataFrame.nlargest`, and :meth:`DataFrame.nsmallest` now accept the value ``"all"`` for the ``keep`` argument. This keeps all ties for the nth largest/smallest value (:issue:`16818`) | |||
- :class:`IntervalIndex` has gained the :meth:`~IntervalIndex.set_closed` method to change the existing ``closed`` value (:issue:`21670`) | |||
- :func:`~DataFrame.to_csv` and :func:`~DataFrame.to_json` now support ``compression='infer'`` to infer compression based on filename (:issue:`15008`) | |||
- | |||
- Changed DatetimeIndex.time to also return timezone information. (:issue:`21358) |
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.
Missing a closing backtick for the issue number. Can you also add an :attr: ref for DatetimeIndex.time?
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.
Does that look good?
Codecov Report
@@ Coverage Diff @@
## master #21865 +/- ##
==========================================
- Coverage 91.92% 91.92% -0.01%
==========================================
Files 160 160
Lines 49906 49903 -3
==========================================
- Hits 45875 45872 -3
Misses 4031 4031
Continue to review full report at Codecov.
|
@@ -577,15 +577,7 @@ def time(self): | |||
""" | |||
Returns numpy array of datetime.time. The time part of the Timestamps. |
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.
Could you expand this docstring to also mention that the datetime.time
objects are in local time with associated timezone information.
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.
Does that look good?
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.
Small nit: could you replace , and contains
with with
. Otherwise LGTM
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.
No problem
does the standard library preserve for |
I guess if we want to follow the standard library naming it should be naive, but I think its useful knowing in which timezone the local time resides. An alternative is to depreciate the Thoughts @jreback? |
hmm its annoying that the std library does this with 2 methods, but I guess can't easily 'remove' a tz from a time (e.g. no |
Yeah that's why I am more inclined to chose the method route to mimic the standard library but at least have a keyword argument (and not a second method) to include the tz in the output or not. |
I can modify or cancel the PR as you guys see fit, just let me know when a decision is made! |
I would personally follow the standard library and leave it as is as a naive time. |
@jquinon thanks for working on it anyhow! |
git diff upstream/master -u -- "*.py" | flake8 --diff
Mainly just reverted changes from GH#21281 and updated docs. Also had to change one test added in GH#21281.