pyarrow.compute.quantile

pyarrow.compute.quantile(array, /, q=0.5, *, interpolation='linear', skip_nulls=True, min_count=0, options=None, memory_pool=None)

Compute an array of quantiles of a numeric array or chunked array.

By default, 0.5 quantile (median) is returned. If quantile lies between two data points, an interpolated value is returned based on selected interpolation method. Nulls and NaNs are ignored. An array of nulls is returned if there is no valid data point.

Parameters
arrayArray-like

Argument to compute function.

qdouble or sequence of double, default 0.5

Quantiles to compute. All values must be in [0, 1].

interpolationstr, default “linear”

How to break ties between competing data points for a given quantile. Accepted values are:

  • “linear”: compute an interpolation

  • “lower”: always use the smallest of the two data points

  • “higher”: always use the largest of the two data points

  • “nearest”: select the data point that is closest to the quantile

  • “midpoint”: compute the (unweighted) mean of the two data points

skip_nullsbool, default True

Whether to skip (ignore) nulls in the input. If False, any null in the input forces the output to null.

min_countint, default 0

Minimum number of non-null values in the input. If the number of non-null values is below min_count, the output is null.

optionspyarrow.compute.QuantileOptions, optional

Alternative way of passing options.

memory_poolpyarrow.MemoryPool, optional

If not passed, will allocate memory from the default memory pool.