Trait polars::prelude::ChunkFilter [−][src]
pub trait ChunkFilter<T> {
fn filter(
&self,
filter: &ChunkedArray<BooleanType>
) -> Result<ChunkedArray<T>, PolarsError>;
}
Expand description
Filter values by a boolean mask.
Required methods
fn filter(
&self,
filter: &ChunkedArray<BooleanType>
) -> Result<ChunkedArray<T>, PolarsError>
fn filter(
&self,
filter: &ChunkedArray<BooleanType>
) -> Result<ChunkedArray<T>, PolarsError>
Filter values in the ChunkedArray with a boolean mask.
let array = Int32Chunked::new_from_slice("array", &[1, 2, 3]);
let mask = BooleanChunked::new_from_slice("mask", &[true, false, true]);
let filtered = array.filter(&mask).unwrap();
assert_eq!(Vec::from(&filtered), [Some(1), Some(3)])