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

[FEA] Allow quantile(0.5) to behave like median and not always return float #14002

Closed
mroeschke opened this issue Aug 29, 2023 · 0 comments · Fixed by #14014
Closed

[FEA] Allow quantile(0.5) to behave like median and not always return float #14002

mroeschke opened this issue Aug 29, 2023 · 0 comments · Fixed by #14014
Assignees
Labels
feature request New feature or request Python Affects Python cuDF API.

Comments

@mroeschke
Copy link
Contributor

Is your feature request related to a problem? Please describe.

In [1]: from cudf import *

In [2]: Series([1, 3, 4]).quantile(0.5, interpolation="lower")
Out[2]: 3.0

In [3]: import pandas

In [4]: pandas.Series([1, 3, 4]).quantile(0.5, interpolation="lower")
Out[4]: 3

In [5]: Series([1, 3, 4]).median()
Out[5]: 3.0

Ideally, it would be great for odd number of values that quantile(0.5) and median respect the original type and not always cast to float.

Describe the solution you'd like
When possible, downcast to the original type for quantile and median

Describe alternatives you've considered
N/A

Additional context
Add any other context, code examples, or references to existing implementations about the feature request here.

@mroeschke mroeschke added feature request New feature or request Needs Triage Need team to review and classify Python Affects Python cuDF API. labels Aug 29, 2023
@galipremsagar galipremsagar self-assigned this Aug 31, 2023
@galipremsagar galipremsagar removed the Needs Triage Need team to review and classify label Aug 31, 2023
rapids-bot bot pushed a commit that referenced this issue Aug 31, 2023
…14014)

closes #14002 

This PR changes the behavior of the `quantile` API by preserving the return type of scalar `interpolation` is either one of `"lower", "higher", "nearest"`.

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #14014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants