Skip to content
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 shift method #461

Merged
merged 4 commits into from
Dec 5, 2023
Merged

Add shift method #461

merged 4 commits into from
Dec 5, 2023

Conversation

milesgranger
Copy link
Collaborator

No description provided.

@milesgranger milesgranger marked this pull request as ready for review December 5, 2023 11:38
after = 0

def _divisions(self):
return self.frame.divisions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think divisions change in shift? Not totally sure

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not sure either. At least in dask.dataframe shift(..) doesn't change.

In [3]: df = pd.DataFrame({'v3': range(5), 'id6': [1, 2, 3, 2, 1]})

In [4]: ddf = dd.from_pandas(df, npartitions=2)

In [5]: ddf.shift(periods=2).divisions
Out[5]: (0, 3, 4)

In [6]: ddf.divisions
Out[6]: (0, 3, 4)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can do ddf.shift(periods=2).enforce_runtime_divisions() to see if the divisions are working as expected


@functools.cached_property
def _meta(self):
return self.frame._meta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta_nonempty

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phofl phofl merged commit e323341 into dask:main Dec 5, 2023
7 checks passed
@phofl
Copy link
Collaborator

phofl commented Dec 5, 2023

thx

@milesgranger milesgranger deleted the milesgranger/shift branch December 5, 2023 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants