Trait polars_core::chunked_array::ops::ChunkApply [−][src]
pub trait ChunkApply<'a, A, B> { fn apply_cast_numeric<F, S>(&'a self, f: F) -> ChunkedArray<S>
where
F: Fn(A) -> S::Native + Copy,
S: PolarsNumericType; fn branch_apply_cast_numeric_no_null<F, S>(
&'a self,
f: F
) -> ChunkedArray<S>
where
F: Fn(Option<A>) -> S::Native + Copy,
S: PolarsNumericType; fn apply<F>(&'a self, f: F) -> Self
where
F: Fn(A) -> B + Copy; fn apply_with_idx<F>(&'a self, f: F) -> Self
where
F: Fn((usize, A)) -> B + Copy; fn apply_with_idx_on_opt<F>(&'a self, f: F) -> Self
where
F: Fn((usize, Option<A>)) -> Option<B> + Copy; }
Expand description
Fastest way to do elementwise operations on a ChunkedArray
Required methods
fn apply_cast_numeric<F, S>(&'a self, f: F) -> ChunkedArray<S> where
F: Fn(A) -> S::Native + Copy,
S: PolarsNumericType,
[src]
fn apply_cast_numeric<F, S>(&'a self, f: F) -> ChunkedArray<S> where
F: Fn(A) -> S::Native + Copy,
S: PolarsNumericType,
[src]Apply a closure elementwise and cast to a Numeric ChunkedArray. This is fastest when the null check branching is more expensive than the closure application.
Null values remain null.
fn branch_apply_cast_numeric_no_null<F, S>(&'a self, f: F) -> ChunkedArray<S> where
F: Fn(Option<A>) -> S::Native + Copy,
S: PolarsNumericType,
[src]
fn branch_apply_cast_numeric_no_null<F, S>(&'a self, f: F) -> ChunkedArray<S> where
F: Fn(Option<A>) -> S::Native + Copy,
S: PolarsNumericType,
[src]Apply a closure on optional values and cast to Numeric ChunkedArray without null values.
fn apply<F>(&'a self, f: F) -> Self where
F: Fn(A) -> B + Copy,
[src]
fn apply<F>(&'a self, f: F) -> Self where
F: Fn(A) -> B + Copy,
[src]Apply a closure elementwise. This is fastest when the null check branching is more expensive than the closure application. Often it is.
Null values remain null.
Example
use polars_core::prelude::*; fn double(ca: &UInt32Chunked) -> UInt32Chunked { ca.apply(|v| v * 2) }
Implementors
impl<'a> ChunkApply<'a, &'a str, Cow<'a, str>> for Utf8Chunked
[src]
impl<'a> ChunkApply<'a, &'a str, Cow<'a, str>> for Utf8Chunked
[src]fn apply_cast_numeric<F, S>(&'a self, f: F) -> ChunkedArray<S> where
F: Fn(&'a str) -> S::Native + Copy,
S: PolarsNumericType,
[src]
F: Fn(&'a str) -> S::Native + Copy,
S: PolarsNumericType,
fn branch_apply_cast_numeric_no_null<F, S>(&'a self, f: F) -> ChunkedArray<S> where
F: Fn(Option<&'a str>) -> S::Native + Copy,
S: PolarsNumericType,
[src]
F: Fn(Option<&'a str>) -> S::Native + Copy,
S: PolarsNumericType,
fn apply<F>(&'a self, f: F) -> Self where
F: Fn(&'a str) -> Cow<'a, str> + Copy,
[src]
F: Fn(&'a str) -> Cow<'a, str> + Copy,
fn apply_with_idx<F>(&'a self, f: F) -> Self where
F: Fn((usize, &'a str)) -> Cow<'a, str> + Copy,
[src]
F: Fn((usize, &'a str)) -> Cow<'a, str> + Copy,
fn apply_with_idx_on_opt<F>(&'a self, f: F) -> Self where
F: Fn((usize, Option<&'a str>)) -> Option<Cow<'a, str>> + Copy,
[src]
F: Fn((usize, Option<&'a str>)) -> Option<Cow<'a, str>> + Copy,
impl<'a> ChunkApply<'a, bool, bool> for BooleanChunked
[src]
impl<'a> ChunkApply<'a, bool, bool> for BooleanChunked
[src]fn apply_cast_numeric<F, S>(&self, f: F) -> ChunkedArray<S> where
F: Fn(bool) -> S::Native + Copy,
S: PolarsNumericType,
[src]
F: Fn(bool) -> S::Native + Copy,
S: PolarsNumericType,
fn branch_apply_cast_numeric_no_null<F, S>(&self, f: F) -> ChunkedArray<S> where
F: Fn(Option<bool>) -> S::Native + Copy,
S: PolarsNumericType,
[src]
F: Fn(Option<bool>) -> S::Native + Copy,
S: PolarsNumericType,
fn apply<F>(&self, f: F) -> Self where
F: Fn(bool) -> bool + Copy,
[src]
F: Fn(bool) -> bool + Copy,
fn apply_with_idx<F>(&'a self, f: F) -> Self where
F: Fn((usize, bool)) -> bool + Copy,
[src]
F: Fn((usize, bool)) -> bool + Copy,
fn apply_with_idx_on_opt<F>(&'a self, f: F) -> Self where
F: Fn((usize, Option<bool>)) -> Option<bool> + Copy,
[src]
F: Fn((usize, Option<bool>)) -> Option<bool> + Copy,
impl<'a> ChunkApply<'a, Series, Series> for ListChunked
[src]
impl<'a> ChunkApply<'a, Series, Series> for ListChunked
[src]fn apply<F>(&'a self, f: F) -> Self where
F: Fn(Series) -> Series + Copy,
[src]
fn apply<F>(&'a self, f: F) -> Self where
F: Fn(Series) -> Series + Copy,
[src]Apply a closure F
elementwise.
fn apply_with_idx<F>(&'a self, f: F) -> Self where
F: Fn((usize, Series)) -> Series + Copy,
[src]
fn apply_with_idx<F>(&'a self, f: F) -> Self where
F: Fn((usize, Series)) -> Series + Copy,
[src]Apply a closure elementwise. The closure gets the index of the element as first argument.
fn apply_with_idx_on_opt<F>(&'a self, f: F) -> Self where
F: Fn((usize, Option<Series>)) -> Option<Series> + Copy,
[src]
fn apply_with_idx_on_opt<F>(&'a self, f: F) -> Self where
F: Fn((usize, Option<Series>)) -> Option<Series> + Copy,
[src]Apply a closure elementwise. The closure gets the index of the element as first argument.
fn apply_cast_numeric<F, S>(&self, f: F) -> ChunkedArray<S> where
F: Fn(Series) -> S::Native + Copy,
S: PolarsNumericType,
[src]
F: Fn(Series) -> S::Native + Copy,
S: PolarsNumericType,
fn branch_apply_cast_numeric_no_null<F, S>(&self, f: F) -> ChunkedArray<S> where
F: Fn(Option<Series>) -> S::Native + Copy,
S: PolarsNumericType,
[src]
F: Fn(Option<Series>) -> S::Native + Copy,
S: PolarsNumericType,
impl<'a, T> ChunkApply<'a, <T as ArrowPrimitiveType>::Native, <T as ArrowPrimitiveType>::Native> for ChunkedArray<T> where
T: PolarsNumericType,
[src]
impl<'a, T> ChunkApply<'a, <T as ArrowPrimitiveType>::Native, <T as ArrowPrimitiveType>::Native> for ChunkedArray<T> where
T: PolarsNumericType,
[src]fn apply_cast_numeric<F, S>(&self, f: F) -> ChunkedArray<S> where
F: Fn(T::Native) -> S::Native + Copy,
S: PolarsNumericType,
[src]
F: Fn(T::Native) -> S::Native + Copy,
S: PolarsNumericType,
fn branch_apply_cast_numeric_no_null<F, S>(&self, f: F) -> ChunkedArray<S> where
F: Fn(Option<T::Native>) -> S::Native + Copy,
S: PolarsNumericType,
[src]
F: Fn(Option<T::Native>) -> S::Native + Copy,
S: PolarsNumericType,
fn apply<F>(&'a self, f: F) -> Self where
F: Fn(T::Native) -> T::Native + Copy,
[src]
F: Fn(T::Native) -> T::Native + Copy,
fn apply_with_idx<F>(&'a self, f: F) -> Self where
F: Fn((usize, T::Native)) -> T::Native + Copy,
[src]
F: Fn((usize, T::Native)) -> T::Native + Copy,
fn apply_with_idx_on_opt<F>(&'a self, f: F) -> Self where
F: Fn((usize, Option<T::Native>)) -> Option<T::Native> + Copy,
[src]
F: Fn((usize, Option<T::Native>)) -> Option<T::Native> + Copy,