Trait polars::chunked_array::ops::ChunkFilter

source ·
pub trait ChunkFilter<T>
where T: PolarsDataType,
{ // Required method fn filter( &self, filter: &ChunkedArray<BooleanType> ) -> Result<ChunkedArray<T>, PolarsError> where Self: Sized; }
Expand description

Filter values by a boolean mask.

Required Methods§

source

fn filter( &self, filter: &ChunkedArray<BooleanType> ) -> Result<ChunkedArray<T>, PolarsError>
where Self: Sized,

Filter values in the ChunkedArray with a boolean mask.

let array = Int32Chunked::new("array", &[1, 2, 3]);
let mask = BooleanChunked::new("mask", &[true, false, true]);

let filtered = array.filter(&mask).unwrap();
assert_eq!(Vec::from(&filtered), [Some(1), Some(3)])

Implementors§