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]);