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

API: quantile with bool/boolean dtypes #51424

Closed
jbrockmendel opened this issue Feb 16, 2023 · 4 comments · Fixed by #53975
Closed

API: quantile with bool/boolean dtypes #51424

jbrockmendel opened this issue Feb 16, 2023 · 4 comments · Fixed by #53975
Labels
API Design Deprecate Functionality to remove in pandas Groupby quantile quantile method
Milestone

Comments

@jbrockmendel
Copy link
Member

jbrockmendel commented Feb 16, 2023

arr = np.random.randn(1000) < 0
ser = pd.Series(arr)

ser.quantile(0.5)  # <- raises

gb = ser.groupby([1] * len(ser))
gb.quantile(0.5)  # <- does not raise

Same behavior for the nullable boolean dtypes.

This should be the same for NDFrame and GroupBy. I'm fine with either allowing or raising as long as we're consistent.

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member API Design quantile quantile method and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Feb 16, 2023
@jbrockmendel
Copy link
Member Author

@mroeschke @phofl preferences here? The mismatch is a blocker in fixing GroupBy.quantile perf #51385.

@mroeschke
Copy link
Member

Looks like Series behavior raises the same error as the numpy behavior. I'm slightly leaning to matching that behavior.

Plus if this was supported, shouldn't the result be bool/boolean (gb looks to return float)?

@phofl
Copy link
Member

phofl commented Mar 4, 2023

I think I'd also prefer raising

@rhshadrach
Copy link
Member

+1 on raising.

@rhshadrach rhshadrach added this to the 2.1 milestone Jul 5, 2023
@rhshadrach rhshadrach added Deprecate Functionality to remove in pandas Groupby labels Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Deprecate Functionality to remove in pandas Groupby quantile quantile method
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants