-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: mul(Tick, float); simplify to_offset #34486
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
@@ -743,6 +747,25 @@ cdef class Tick(SingleConstructorOffset): | |||
"Tick offset with `normalize=True` are not allowed." | |||
) | |||
|
|||
# FIXME: Without making this cpdef, we get AttributeError when calling | |||
# from __mul__ | |||
cpdef Tick _next_higher_resolution(Tick 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.
wouldn't this be better as a module level routine?
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 dont think so. it uses self.n
, so really makes sense as a method
@@ -3563,6 +3601,9 @@ cpdef to_offset(freq): | |||
>>> to_offset(Hour()) | |||
<Hour> | |||
""" | |||
# TODO: avoid runtime imports |
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.
really really prefer absolute imports
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.
sure. im more concerned about getting rid of the runtime imports
@@ -3598,15 +3641,19 @@ cpdef to_offset(freq): | |||
if not stride: | |||
stride = 1 | |||
|
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 give some comments on what is being done here
assert isinstance(result, Micro) | ||
|
||
# Case where we bump up to the next type | ||
result = off * 1.25 |
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.
was this buggy before? need a whatsnew note if so
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.
ATM it raises TypeError for any float, will add whatsnew
kk if u can rebase |
rebased+green |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
This will let us remove Resolution.get_stride_from_decimal