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

Implement Series.quantile #517

Merged
merged 7 commits into from
Dec 11, 2023
Merged

Implement Series.quantile #517

merged 7 commits into from
Dec 11, 2023

Conversation

phofl
Copy link
Collaborator

@phofl phofl commented Dec 11, 2023

We can't really test tdigest at the moment, it's not compatible with the newest NumPy and I don't want to create a new ci job for this.

Tested it locally and it works for now

@crusaderky crusaderky changed the title Implement quantile Implement Series.quantile Dec 11, 2023
Copy link
Collaborator

@crusaderky crusaderky left a comment

Choose a reason for hiding this comment

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

Only minor notes

@@ -1285,6 +1286,13 @@ def rename(self, index):
return new_collection(expr.RenameSeries(self.expr, index))
raise NotImplementedError(f"passing index={type(index)} is not supported")

def quantile(self, q=0.5, method="default"):
Copy link
Collaborator

@crusaderky crusaderky Dec 11, 2023

Choose a reason for hiding this comment

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

Out of scope: this could get easily confused with the method parameter of pandas.DataFrame.quantile.
We should rename it both here and in dask/dask to dask_method or something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep good point, but I’d rather do this not with all the other changes

dask_expr/_collection.py Outdated Show resolved Hide resolved
dask_expr/_quantile.py Outdated Show resolved Hide resolved
Comment on lines +1672 to +1673
with pytest.raises(AssertionError):
df.x.quantile(q=[]).compute()
Copy link
Collaborator

Choose a reason for hiding this comment

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

pandas returns an empty series here. Doubt we care to diverge on such an edge case though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I thought this was kind of pointless, but I might put up a follow up anyway

@phofl phofl merged commit f9c6f5b into dask:main Dec 11, 2023
@phofl phofl deleted the quantile branch December 11, 2023 17:59
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.

2 participants