polars::prelude

Trait 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".into(), &[1, 2, 3]);
let mask = BooleanChunked::new("mask".into(), &[true, false, true]);

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

Implementors§

Source§

impl ChunkFilter<BinaryType> for ChunkedArray<BinaryType>

Source§

impl ChunkFilter<StringType> for ChunkedArray<StringType>

Source§

impl<T> ChunkFilter<ObjectType<T>> for ChunkedArray<ObjectType<T>>
where T: PolarsObject,

Available on crate feature object only.
Source§

impl<T> ChunkFilter<T> for ChunkedArray<T>
where T: PolarsDataType<HasViews = FalseT, IsObject = FalseT>,