-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Add unit
property and as_unit
method to DatetimeIndex
, TimedeltaIndex
and Series.dt
#865
Add unit
property and as_unit
method to DatetimeIndex
, TimedeltaIndex
and Series.dt
#865
Conversation
dc1dace
to
cd35a2f
Compare
_DTRoundingMethodReturnType = TypeVar( | ||
"_DTRoundingMethodReturnType", | ||
_DTTimestampTimedeltaReturnType = TypeVar( | ||
"_DTTimestampTimedeltaReturnType", |
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.
Rename to a general name to reuse this type var in the return type annotation for as_unit
method
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.
As suggested in #864 , can you use TimeUnit
throughout instead of Literal
Otherwise, this looks OK
cd35a2f
to
9120dce
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.
thanks @skatsuta
assert_type()
to assert the type of any return valueAdd
unit
property andas_unit
method toDatetimeIndex
,TimedeltaIndex
andSeries.dt
,to add support for the following items in #624:
Note: The addition to
TimelikeOps
is not necessarily needed to add support forSeries.dt
, but since it is in the pandas implementation, we should also add it in this stub for consistency.