rowPercentileOfOrNull
Returns the given percentile of the comparable values of type T in this DataRow, or null if there is nothing to compute the percentile of.
Only the values in the columns of type T (or T?) are taken into account; all other columns of the row are ignored.
Columns inside column groups are also excluded. To include those in the percentile, flatten the DataFrame first.
This overload is meant for non-number self-comparable types, like String or dates.
Careful: Calling this function with a primitive number type, like <Int>, without passing skipNaN also resolves to this overload, instead of the one returning a Double. The interpolated Double result is then returned as T, which may truncate it or throw a ClassCastException. Pass skipNaN explicitly (like skipNaN = false) to call the overload for numbers.
Only self-comparable values are supported: values of a type T : Comparable<T> that are mutually comparable (like strings, primitive numbers, or dates). This includes all primitive number types, but no mix of different number types, which would result in a ClassCastException.
null values in the input are always ignored.
Returns null when there is nothing to compute the percentile of, for instance, when the input is empty or contains only null values.
The resulting percentile is selected from the values using quantile estimation method R3, so it has the same type as the values (minus nullability, if the values were nullable).
Currently, only the default quantile estimation methods can be used. In the future, it might become possible to choose a different one, see #1121.
For more information about the resulting types: See "percentile Type Conversion" on the documentation website.
See also:
rowPercentileOf— throws instead of returningnullwhen there's nothing to compute the percentile of.percentileOrNull— the percentile of the values in specific columns of aDataFrame.The Percentile Operation— an overview of allpercentilemodes.
For more information: See "Row statistics" on the documentation website.
Example
// The first quartile of all `String` values ("name"/"firstName", "name"/"lastName", and "city")
// in the first row, or `null` if there are none
df.flatten()[0].rowPercentileOfOrNull<String>(25.0)Return
The given percentile of the values of type T in this row, or null if there are no values to compute the percentile of.
Parameters
The percentile to compute, in the range [0.0, 100.0], like 25.0 for the first quartile, 50.0 for the median, or 75.0 for the third quartile. A percentile outside this range causes an IllegalStateException.
Type Parameters
The type of the values to include. Only columns of this type are taken into account.
Returns the given percentile of the numbers of type T in this DataRow, as a Double, or null if there is nothing to compute the percentile of.
Only the values in the columns of type T (or T?) are taken into account; all other columns of the row are ignored.
Columns inside column groups are also excluded. To include those in the percentile, flatten the DataFrame first.
Careful: To call this overload, skipNaN must be passed explicitly (like skipNaN = false). Without it, a call like <Int> resolves to the overload for comparable values instead, which returns the interpolated result as T, possibly truncating it or throwing a ClassCastException.
Only self-comparable values are supported: values of a type T : Comparable<T> that are mutually comparable (like strings, primitive numbers, or dates). This includes all primitive number types, but no mix of different number types, which would result in a ClassCastException.
null values in the input are always ignored.
If the input contains values, the result will be NaNNaN, unless skipNaN is set to true.
Returns null when there is nothing to compute the percentile of, for instance, when the input is empty or contains only null values.
The resulting percentile is a Double, interpolated between the values using quantile estimation method R8. Converting Long values to Double may lose precision for very large values.
Currently, only the default quantile estimation methods can be used. In the future, it might become possible to choose a different one, see #1121.
Big numbers (, BigInteger) are not explicitly supported. They are self-comparable, so some overloads select a value without interpolating it, while others throw an exception at runtime. Don't rely on this; BigDecimal them to a primitive number type first.convert
For more information about the resulting types: See "percentile Type Conversion" on the documentation website.
See also:
rowPercentileOf— throws instead of returningnullwhen there's nothing to compute the percentile of.percentileOrNull— the percentile of the values in specific columns of aDataFrame.The Percentile Operation— an overview of allpercentilemodes.
For more information: See "Row statistics" on the documentation website.
Example
// The third quartile of all `Int` values ("age" and "weight") in the first row, or `null` if there are none
df[0].rowPercentileOfOrNull<Int>(75.0, skipNaN = false)Return
The given percentile of the values of type T in this row, as a Double, or null if there are no values to compute the percentile of.
Parameters
The percentile to compute, in the range [0.0, 100.0], like 25.0 for the first quartile, 50.0 for the median, or 75.0 for the third quartile. A percentile outside this range causes an IllegalStateException.
Type Parameters
The type of the values to include. Only columns of this type are taken into account.