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".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§
impl ChunkFilter<BinaryType> for ChunkedArray<BinaryType>
impl ChunkFilter<StringType> for ChunkedArray<StringType>
impl<T> ChunkFilter<ObjectType<T>> for ChunkedArray<ObjectType<T>>where
T: PolarsObject,
Available on crate feature
object
only.