-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Open
Labels
Closing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsEnhancementNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action
Description
Is your feature request related to a problem?
No
Describe the solution you'd like
I would like a built-in shift function that shifts each row by a different period, given by a Series.
API breaking implications
It would improve the shift possibilities.
Describe alternatives you've considered
Using shift with apply and lambda.
Additional context
[add any other context, code examples, or references to existing implementations about the feature request here]
def shift_df_by_series(self, df=pd.DataFrame, s=pd.Series) -> pd.DataFrame:
return df.apply(lambda shifted_df: shifted_df.shift(periods=s[shifted_df.name], fill_value=0), axis='columns')
Metadata
Metadata
Assignees
Labels
Closing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsEnhancementNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action