Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
rank in datafusion::common::arrow::compute - Rust
[go: Go Back, main page]

Function datafusion::common::arrow::compute::rank

source ·
pub fn rank(
    array: &dyn Array,
    options: Option<SortOptions>
) -> Result<Vec<u32>, ArrowError>
Expand description

Assigns a rank to each value in array based on its position in the sorted order

Where values are equal, they will be assigned the highest of their ranks, leaving gaps in the overall rank assignment

let array = StringArray::from(vec![Some("foo"), None, Some("foo"), None, Some("bar")]);
let ranks = rank(&array, None).unwrap();
assert_eq!(ranks, &[5, 2, 5, 2, 3]);