-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Resolves Issue 21344: provide a timedelta in a non-string format #21444
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
| return "D" | ||
|
|
||
| @property | ||
| def resolution_timedelta(self): |
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.
The general idea was to have this new property return Timedelta(nanosecond=1) akin to how datetime.timedelta.resolution returns timedelta(microseconds=1)
| """ return a string representing the lowest resolution that we have """ | ||
| """ | ||
| Return a string representing the lowest resolution that we have. | ||
| Note that this is nonstandard behavior. |
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.
Instead, could you create a "See Also" section with the new method name, similar to this: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.isin.html
| def resolution(self): | ||
| """ return a string representing the lowest resolution that we have """ | ||
| """ | ||
| Return a string representing the lowest resolution that we have. |
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.
Instead of lowest resolution that we have, I think I'd be clearer if it was lowest resolution of the Timedelta instance
| def resolution_timedelta(self): | ||
| """ | ||
| Return a timedelta object (rather than a string) | ||
| representing the lowest resolution we have. |
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.
Instead of lowest resolution that we have, I think I'd be clearer if it was lowest resolution of the Timedelta class
| """ | ||
| Return a timedelta object (rather than a string) | ||
| representing the lowest resolution we have. | ||
| to retrieve a string use the resolution property. |
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.
Instead, could you create a "See Also" section with the new method name, similar to this: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.isin.html
|
|
||
| - Tab completion on :class:`Index` in IPython no longer outputs deprecation warnings (:issue:`21125`) | ||
| - Bug preventing pandas being used on Windows without C++ redistributable installed (:issue:`21106`) | ||
| - Add `resolution_timedelta` to :class:`Timedelta` to get non-string representations of resolution (:issue: `21344`) |
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 move to v0.23.2.txt
|
This would then be an API change, but conform to |
|
can you rebase |
|
closing as stale. if you'd like to continue, pls ping. |
git diff upstream/master -u -- "*.py" | flake8 --diffThis extends the API - and there is a judgement call about how to treat nanosecond-resolution pd.Timedelta() objects in the context of datetime.timedelta() objects.