-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC: Update the DatetimeIndex.normalize docstring #20094
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
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.
LGTM
Codecov Report
@@ Coverage Diff @@
## master #20094 +/- ##
=========================================
Coverage ? 91.7%
=========================================
Files ? 150
Lines ? 49152
Branches ? 0
=========================================
Hits ? 45074
Misses ? 4078
Partials ? 0
Continue to review full report at Codecov.
|
pandas/core/indexes/datetimes.py
Outdated
Return DatetimeIndex with times converted to midnight. | ||
|
||
When using DatetimeIndex, the time can be converted to midnight i.e. | ||
00:00:00. This is useful in cases, when the time does not matter in |
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.
This useful in cases where the time does not matter (remove the in DataFrame). The length of the DatetimeIndex is unaltered.
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.
maybe mention this does not affect tz's
pandas/core/indexes/datetimes.py
Outdated
Examples | ||
-------- | ||
>>> df = pd.DataFrame({'date':['2015-05-01 18:47:05.060000', | ||
... '2014-05-01 18:47:05.110000']}) |
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.
can you add another example with a tz.
pandas/core/indexes/datetimes.py
Outdated
Return DatetimeIndex with times converted to midnight. | ||
|
||
When using DatetimeIndex, the time can be converted to midnight i.e. | ||
00:00:00. This is useful in cases, when the time does not matter in |
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.
maybe mention this does not affect tz's
@jreback required changes done, please review 😀 |
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 changes, otherwise lgtm.
pandas/core/indexes/datetimes.py
Outdated
|
||
When using DatetimeIndex, the time can be converted to midnight i.e. | ||
00:00:00. This is useful in cases, when the time does not matter. | ||
Length is unaltered. The timezones are unaffected. If the frequency |
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.
I would remove the last sentence. freq is actually re-inferred here, so this is misleading.
pandas/core/indexes/datetimes.py
Outdated
@@ -1770,11 +1770,38 @@ def date(self): | |||
|
|||
def normalize(self): | |||
""" | |||
Return DatetimeIndex with times to midnight. Length is unaltered | |||
Return DatetimeIndex with times converted to midnight. |
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.
Please, make a simpler description. I suggest Convert times to midnight
.
Signed-off-by: Tushar Mittal <chiragmittal.mittal@gmail.com>
done! |
0c0df1b
to
84aab8e
Compare
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.
Looks good!
I made a few edits to make it more generic for both DatetimeIndex and Series.dt (they share the docstring)
Signed-off-by: Tushar Mittal chiragmittal.mittal@gmail.com
Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):
scripts/validate_docstrings.py <your-function-or-method>
git diff upstream/master -u -- "*.py" | flake8 --diff
python doc/make.py --single <your-function-or-method>
Please include the output of the validation script below between the "```" ticks:
If the validation script still gives errors, but you think there is a good reason
to deviate in this case (and there are certainly such cases), please state this
explicitly.
Checklist for other PRs (remove this part if you are doing a PR for the pandas documentation sprint):