Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ENH: .shift optionally takes multiple periods #54115
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: .shift optionally takes multiple periods #54115
Changes from all commits
4e1a84e
db9cd03
9def045
b7ea297
299927a
6cf632e
23d9142
b78d7d6
cabd28c
5017721
6f3ec9b
8d085f3
6e66a19
f7ea7a3
f8e29d9
e54ba33
715c397
21e8e70
0e78963
2c602e2
d9bf54f
778b7e9
ad49861
28469db
c8e5bad
cb4013d
226fa6f
cb49cac
44b0866
5257292
eff4ed2
04d4513
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 is necessary because Series.shift can now return a dataframe if there are multiple periods. Mypy complains at this line because it wants Series and not
Series | Dataframe
, but because there is only one lag, it's alwaysSeries
, so we can justcast
.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.
You could add type-overloads to handle this. Sometimes they can get gnarly (see e.g. concat), but I think this one should be relatively straight forward.
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'd prefer not to if that's ok? There is no
Series.shift
to overload so I feel like it would be confusing to newcomers like me.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.
If you insist I will try!
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.
Otherwise I think this is done?
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.
Hi @rhshadrach , do you have time for another round/sign this off?
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'm okay with opening an issue regarding this once it's merged for someone to followup on.