Trait polars::prelude::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§
sourcefn filter(
&self,
filter: &ChunkedArray<BooleanType>
) -> Result<ChunkedArray<T>, PolarsError>where
Self: Sized,
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§
impl ChunkFilter<BinaryOffsetType> for ChunkedArray<BinaryOffsetType>
impl ChunkFilter<BinaryType> for ChunkedArray<BinaryType>
impl ChunkFilter<BooleanType> for ChunkedArray<BooleanType>
impl ChunkFilter<FixedSizeListType> for ChunkedArray<FixedSizeListType>
Available on crate feature
dtype-array
only.impl ChunkFilter<ListType> for ChunkedArray<ListType>
impl ChunkFilter<StringType> for ChunkedArray<StringType>
impl<T> ChunkFilter<ObjectType<T>> for ChunkedArray<ObjectType<T>>where
T: PolarsObject,
Available on crate feature
object
only.