Type Definition arrow_array::array::Float16Array

source ·
pub type Float16Array = PrimitiveArray<Float16Type>;
Expand description

A PrimitiveArray of f16

Examples

Construction

use half::f16;
// Create from Vec<Option<f16>>
let arr = Float16Array::from(vec![Some(f16::from_f64(1.0)), Some(f16::from_f64(2.0))]);
// Create from Vec<i8>
let arr = Float16Array::from(vec![f16::from_f64(1.0), f16::from_f64(2.0), f16::from_f64(3.0)]);
// Create iter/collect
let arr: Float16Array = std::iter::repeat(f16::from_f64(1.0)).take(10).collect();

Example: Using collect

use half::f16;
let arr : Float16Array = [Some(f16::from_f64(1.0)), Some(f16::from_f64(2.0))].into_iter().collect();

See PrimitiveArray for more information and examples