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

BUG: Fix np.quantile([Fraction(2,1)], 0.5) (#24711) #25756

Merged
merged 1 commit into from Feb 3, 2024

Conversation

charris
Copy link
Member

@charris charris commented Feb 3, 2024

Backport of #24711.

On main:

import numpy as np
from fractions import Fraction
arr = np.array([Fraction(1, 1), Fraction(2, 1), Fraction(3, 1)])
np.quantile(arr, 0) # output: Fraction(1, 1)
np.quantile(arr, Fraction(1, 2)) # output: Fraction(2, 1)
np.quantile(arr, 0.5) # raises an error

In this PR we update the np.quantile to handle the case np.quantile(arr, 0.5) as well.

Also see #24592

  • BUG: Fix np.quantile([Fraction(2,1)], 0.5)

  • address review comments

  • pass type instead of dtype instance

* BUG: Fix np.quantile([Fraction(2,1)], 0.5)

* address review comments

* pass type instead of dtype instance
@charris charris added this to the 1.26.4 release milestone Feb 3, 2024
@charris charris merged commit ce89a0a into numpy:maintenance/1.26.x Feb 3, 2024
59 of 60 checks passed
@charris charris deleted the backport-24711 branch February 3, 2024 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants