Function polars_arrow::compute::cast::primitive_to_dictionary

source ·
pub fn primitive_to_dictionary<T: NativeType + Eq + Hash, K: DictionaryKey>(
    from: &PrimitiveArray<T>,
) -> PolarsResult<DictionaryArray<K>>
Available on crate feature compute_cast only.
Expand description

Cast PrimitiveArray to DictionaryArray. Also known as packing.

§Errors

This function errors if the maximum key is smaller than the number of distinct elements in the array.