Clean up percentiles_summary
logic
#11094
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is essentially a revision of #10551, which generalized the partition-wise
quantiles
logic used inpercentiles_summary
to work with bothcudf
andpandas
-backed data. It turns out that those changes do not quite cover the case that a numerical column contains null values.An additional problem with the current logic is that error handling for the
.values
operation is mixed with error handling for thequantile
operation itself. This PR separates these steps a bit to make the logic less confusing.Overview of the partition-wise
quantiles
logic after this PR:Series.quantile
method (without calling.values
yet)DataFrame.quantile(..., method="table")
method as ifpandas>=1.5
pandas<1.5
, we fall back topercentile
(this entire code path can be removed when pandas2+ is required).values
. Sincecudf->cupy
will fail to do this for string columns and/or null values, we simplypass
if this step fails..values
here at all. I believe NEP18 covers all necessarySeries
logic anyway. Perhaps we can remove this step?