Type Definition polars_core::datatypes::ListChunked
source · [−]pub type ListChunked = ChunkedArray<ListType>;
Implementations
sourceimpl ListChunked
impl ListChunked
pub fn par_iter(&self) -> impl ParallelIterator<Item = Option<Series>> + '_
sourceimpl ListChunked
impl ListChunked
sourcepub fn to_ndarray<N>(&self) -> Result<Array2<N::Native>> where
N: PolarsNumericType,
Available on crate feature ndarray
only.
pub fn to_ndarray<N>(&self) -> Result<Array2<N::Native>> where
N: PolarsNumericType,
ndarray
only.If all nested Series
have the same length, a 2 dimensional ndarray::Array
is returned.
sourceimpl ListChunked
impl ListChunked
sourcepub fn amortized_iter(
&self
) -> AmortizedListIter<'_, impl Iterator<Item = Option<ArrayBox>> + '_>
pub fn amortized_iter(
&self
) -> AmortizedListIter<'_, impl Iterator<Item = Option<ArrayBox>> + '_>
This is an iterator over a ListChunked that save allocations.
A Series is:
1. Arc
The ArrayRef we indicated with 3. will be updated during iteration. The Series will be pinned in memory, saving an allocation for
- Arc<..>
- Vec<…>
Warning
Though memory safe in the sense that it will not read unowned memory, UB, or memory leaks
this function still needs precautions. The returned should never be cloned or taken longer
than a single iteration, as every call on next
of the iterator will change the contents of
that Series.
sourcepub fn apply_amortized<'a, F>(&'a self, f: F) -> Self where
F: FnMut(UnstableSeries<'a>) -> Series,
pub fn apply_amortized<'a, F>(&'a self, f: F) -> Self where
F: FnMut(UnstableSeries<'a>) -> Series,
Apply a closure F
elementwise.
pub fn try_apply_amortized<'a, F>(&'a self, f: F) -> Result<Self> where
F: FnMut(UnstableSeries<'a>) -> Result<Series>,
sourceimpl ListChunked
impl ListChunked
sourcepub fn lst_join(&self, separator: &str) -> Result<Utf8Chunked>
Available on crate feature list
only.
pub fn lst_join(&self, separator: &str) -> Result<Utf8Chunked>
list
only.In case the inner dtype DataType::Utf8
, the individual items will be joined into a
single string separated by separator
.
pub fn lst_max(&self) -> Series
list
only.pub fn lst_min(&self) -> Series
list
only.pub fn lst_sum(&self) -> Series
list
only.pub fn lst_mean(&self) -> Float64Chunked
list
only.pub fn lst_sort(&self, reverse: bool) -> ListChunked
list
only.pub fn lst_reverse(&self) -> ListChunked
list
only.pub fn lst_unique(&self) -> Result<ListChunked>
list
only.pub fn lst_arg_min(&self) -> IdxCa
list
only.pub fn lst_arg_max(&self) -> IdxCa
list
only.pub fn lst_diff(&self, n: usize, null_behavior: NullBehavior) -> ListChunked
list
and diff
only.pub fn lst_shift(&self, periods: i64) -> ListChunked
list
only.pub fn lst_slice(&self, offset: i64, length: usize) -> ListChunked
list
only.pub fn lst_lengths(&self) -> UInt32Chunked
list
only.sourcepub fn lst_get(&self, idx: i64) -> Result<Series>
Available on crate feature list
only.
pub fn lst_get(&self, idx: i64) -> Result<Series>
list
only.Get the value by index in the sublists.
So index 0
would return the first item of every sublist
and index -1
would return the last item of every sublist
if an index is out of bounds, it will return a None
.
pub fn lst_concat(&self, other: &[Series]) -> Result<ListChunked>
list
only.sourceimpl ListChunked
impl ListChunked
pub fn set_fast_explode(&mut self)
pub fn to_logical(&mut self, inner_dtype: DataType)
sourceimpl ListChunked
impl ListChunked
sourcepub fn inner_dtype(&self) -> DataType
pub fn inner_dtype(&self) -> DataType
Get the inner data type of the list.
Trait Implementations
sourceimpl AggList for ListChunked
impl AggList for ListChunked
fn agg_list(&self, groups: &GroupsProxy) -> Option<Series>
sourceimpl ArgAgg for ListChunked
impl ArgAgg for ListChunked
sourceimpl ChunkAggSeries for ListChunked
impl ChunkAggSeries for ListChunked
sourcefn sum_as_series(&self) -> Series
fn sum_as_series(&self) -> Series
Get the sum of the ChunkedArray as a new Series of length 1.
sourcefn max_as_series(&self) -> Series
fn max_as_series(&self) -> Series
Get the max of the ChunkedArray as a new Series of length 1.
sourcefn min_as_series(&self) -> Series
fn min_as_series(&self) -> Series
Get the min of the ChunkedArray as a new Series of length 1.
sourcefn prod_as_series(&self) -> Series
fn prod_as_series(&self) -> Series
Get the product of the ChunkedArray as a new Series of length 1.
sourceimpl ChunkAnyValue for ListChunked
impl ChunkAnyValue for ListChunked
sourceunsafe fn get_any_value_unchecked(&self, index: usize) -> AnyValue<'_>
unsafe fn get_any_value_unchecked(&self, index: usize) -> AnyValue<'_>
Get a single value. Beware this is slow. If you need to use this slightly performant, cast Categorical to UInt32 Read more
sourcefn get_any_value(&self, index: usize) -> AnyValue<'_>
fn get_any_value(&self, index: usize) -> AnyValue<'_>
Get a single value. Beware this is slow.
sourceimpl<'a> ChunkApply<'a, Series, Series> for ListChunked
impl<'a> ChunkApply<'a, Series, Series> for ListChunked
sourcefn apply<F>(&'a self, f: F) -> Self where
F: Fn(Series) -> Series + Copy,
fn apply<F>(&'a self, f: F) -> Self where
F: Fn(Series) -> Series + Copy,
Apply a closure F
elementwise.
sourcefn apply_with_idx<F>(&'a self, f: F) -> Self where
F: Fn((usize, Series)) -> Series + Copy,
fn apply_with_idx<F>(&'a self, f: F) -> Self where
F: Fn((usize, Series)) -> Series + Copy,
Apply a closure elementwise. The closure gets the index of the element as first argument.
sourcefn apply_with_idx_on_opt<F>(&'a self, f: F) -> Self where
F: Fn((usize, Option<Series>)) -> Option<Series> + Copy,
fn apply_with_idx_on_opt<F>(&'a self, f: F) -> Self where
F: Fn((usize, Option<Series>)) -> Option<Series> + Copy,
Apply a closure elementwise. The closure gets the index of the element as first argument.
sourcefn apply_cast_numeric<F, S>(&self, f: F) -> ChunkedArray<S> where
F: Fn(Series) -> S::Native + Copy,
S: PolarsNumericType,
fn apply_cast_numeric<F, S>(&self, f: F) -> ChunkedArray<S> where
F: Fn(Series) -> S::Native + Copy,
S: PolarsNumericType,
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. Read more
sourcefn branch_apply_cast_numeric_no_null<F, S>(&self, f: F) -> ChunkedArray<S> where
F: Fn(Option<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,
Apply a closure on optional values and cast to Numeric ChunkedArray without null values.
fn try_apply<F>(&'a self, f: F) -> Result<Self> where
F: Fn(Series) -> Result<Series> + Copy,
sourceimpl ChunkCast for ListChunked
impl ChunkCast for ListChunked
We cannot cast anything to or from List/LargeList So this implementation casts the inner type
sourceimpl ChunkCompare<&'_ ChunkedArray<ListType>> for ListChunked
impl ChunkCompare<&'_ ChunkedArray<ListType>> for ListChunked
type Item = ChunkedArray<BooleanType>
sourcefn eq_missing(&self, rhs: &ListChunked) -> BooleanChunked
fn eq_missing(&self, rhs: &ListChunked) -> BooleanChunked
Check for equality and regard missing values as equal.
sourcefn equal(&self, rhs: &ListChunked) -> BooleanChunked
fn equal(&self, rhs: &ListChunked) -> BooleanChunked
Check for equality.
sourcefn not_equal(&self, rhs: &ListChunked) -> BooleanChunked
fn not_equal(&self, rhs: &ListChunked) -> BooleanChunked
Check for inequality.
sourcefn gt(&self, _rhs: &ListChunked) -> BooleanChunked
fn gt(&self, _rhs: &ListChunked) -> BooleanChunked
Greater than comparison.
sourcefn gt_eq(&self, _rhs: &ListChunked) -> BooleanChunked
fn gt_eq(&self, _rhs: &ListChunked) -> BooleanChunked
Greater than or equal comparison.
sourcefn lt(&self, _rhs: &ListChunked) -> BooleanChunked
fn lt(&self, _rhs: &ListChunked) -> BooleanChunked
Less than comparison.
sourcefn lt_eq(&self, _rhs: &ListChunked) -> BooleanChunked
fn lt_eq(&self, _rhs: &ListChunked) -> BooleanChunked
Less than or equal comparison
sourceimpl ChunkExpandAtIndex<ListType> for ListChunked
impl ChunkExpandAtIndex<ListType> for ListChunked
sourcefn expand_at_index(&self, index: usize, length: usize) -> ListChunked
fn expand_at_index(&self, index: usize, length: usize) -> ListChunked
Create a new ChunkedArray filled with values at that index.
sourceimpl ChunkExplode for ListChunked
impl ChunkExplode for ListChunked
sourceimpl ChunkFillNull for ListChunked
impl ChunkFillNull for ListChunked
sourcefn fill_null(&self, _strategy: FillNullStrategy) -> Result<Self>
fn fill_null(&self, _strategy: FillNullStrategy) -> Result<Self>
Replace None values with one of the following strategies: Read more
sourceimpl ChunkFillNullValue<&'_ Series> for ListChunked
impl ChunkFillNullValue<&'_ Series> for ListChunked
sourcefn fill_null_with_values(&self, _value: &Series) -> Result<Self>
fn fill_null_with_values(&self, _value: &Series) -> Result<Self>
Replace None values with a give value T
.
sourceimpl ChunkFilter<ListType> for ListChunked
impl ChunkFilter<ListType> for ListChunked
sourcefn filter(&self, filter: &BooleanChunked) -> Result<ListChunked>
fn filter(&self, filter: &BooleanChunked) -> Result<ListChunked>
Filter values in the ChunkedArray with a boolean mask. Read more
sourceimpl ChunkFull<&'_ Series> for ListChunked
impl ChunkFull<&'_ Series> for ListChunked
sourceimpl ChunkFullNull for ListChunked
impl ChunkFullNull for ListChunked
fn full_null(name: &str, length: usize) -> ListChunked
sourceimpl ChunkOps for ListChunked
impl ChunkOps for ListChunked
sourceimpl ChunkQuantile<Series> for ListChunked
impl ChunkQuantile<Series> for ListChunked
sourceimpl ChunkReverse<ListType> for ListChunked
impl ChunkReverse<ListType> for ListChunked
sourceimpl ChunkShift<ListType> for ListChunked
impl ChunkShift<ListType> for ListChunked
sourceimpl ChunkShiftFill<ListType, Option<&'_ Series>> for ListChunked
impl ChunkShiftFill<ListType, Option<&'_ Series>> for ListChunked
sourcefn shift_and_fill(
&self,
periods: i64,
fill_value: Option<&Series>
) -> ListChunked
fn shift_and_fill(
&self,
periods: i64,
fill_value: Option<&Series>
) -> ListChunked
Shift the values by a given period and fill the parts that will be empty due to this operation
with fill_value
. Read more
sourceimpl ChunkTake for ListChunked
impl ChunkTake for ListChunked
sourceunsafe fn take_unchecked<I, INulls>(
&self,
indices: TakeIdx<'_, I, INulls>
) -> Self where
Self: Sized,
I: TakeIterator,
INulls: TakeIteratorNulls,
unsafe fn take_unchecked<I, INulls>(
&self,
indices: TakeIdx<'_, I, INulls>
) -> Self where
Self: Sized,
I: TakeIterator,
INulls: TakeIteratorNulls,
Take values from ChunkedArray by index. Read more
sourcefn take<I, INulls>(&self, indices: TakeIdx<'_, I, INulls>) -> Result<Self> where
Self: Sized,
I: TakeIterator,
INulls: TakeIteratorNulls,
fn take<I, INulls>(&self, indices: TakeIdx<'_, I, INulls>) -> Result<Self> where
Self: Sized,
I: TakeIterator,
INulls: TakeIteratorNulls,
Take values from ChunkedArray by index. Note that the iterator will be cloned, so prefer an iterator that takes the owned memory by reference. Read more
sourceimpl ChunkTakeEvery<ListType> for ListChunked
impl ChunkTakeEvery<ListType> for ListChunked
sourcefn take_every(&self, n: usize) -> ListChunked
fn take_every(&self, n: usize) -> ListChunked
Traverse and collect every nth element in a new array.
sourceimpl ChunkVar<Series> for ListChunked
impl ChunkVar<Series> for ListChunked
sourceimpl ChunkZip<ListType> for ListChunked
impl ChunkZip<ListType> for ListChunked
sourcefn zip_with(
&self,
mask: &BooleanChunked,
other: &ChunkedArray<ListType>
) -> Result<ChunkedArray<ListType>>
fn zip_with(
&self,
mask: &BooleanChunked,
other: &ChunkedArray<ListType>
) -> Result<ChunkedArray<ListType>>
Create a new ChunkedArray with values from self where the mask evaluates true
and values
from other
where the mask evaluates false
Read more
sourceimpl Debug for ListChunked
impl Debug for ListChunked
sourceimpl FromIterator<Option<Box<dyn Array + 'static, Global>>> for ListChunked
impl FromIterator<Option<Box<dyn Array + 'static, Global>>> for ListChunked
sourceimpl FromIterator<Option<Series>> for ListChunked
impl FromIterator<Option<Series>> for ListChunked
sourceimpl<Ptr> FromIterator<Ptr> for ListChunked where
Ptr: Borrow<Series>,
impl<Ptr> FromIterator<Ptr> for ListChunked where
Ptr: Borrow<Series>,
sourcefn from_iter<I: IntoIterator<Item = Ptr>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Ptr>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl FromParallelIterator<Option<Series>> for ListChunked
impl FromParallelIterator<Option<Series>> for ListChunked
sourcefn from_par_iter<I>(iter: I) -> Self where
I: IntoParallelIterator<Item = Option<Series>>,
fn from_par_iter<I>(iter: I) -> Self where
I: IntoParallelIterator<Item = Option<Series>>,
Creates an instance of the collection from the parallel iterator par_iter
. Read more
sourceimpl FromTrustedLenIterator<Option<Series>> for ListChunked
impl FromTrustedLenIterator<Option<Series>> for ListChunked
fn from_iter_trusted_length<I: IntoIterator<Item = Option<Series>>>(
iter: I
) -> Self
sourceimpl<Ptr> FromTrustedLenIterator<Ptr> for ListChunked where
Ptr: Borrow<Series>,
impl<Ptr> FromTrustedLenIterator<Ptr> for ListChunked where
Ptr: Borrow<Series>,
fn from_iter_trusted_length<I: IntoIterator<Item = Ptr>>(iter: I) -> Self
sourceimpl IntoGroupsProxy for ListChunked
impl IntoGroupsProxy for ListChunked
sourcefn group_tuples(&self, _multithreaded: bool, _sorted: bool) -> GroupsProxy
fn group_tuples(&self, _multithreaded: bool, _sorted: bool) -> GroupsProxy
Create the tuples need for a groupby operation. * The first value in the tuple is the first index of the group. * The second value in the tuple is are the indexes of the groups including the first value. Read more
sourceimpl<'a> IntoIterator for &'a ListChunked
impl<'a> IntoIterator for &'a ListChunked
type IntoIter = Box<dyn PolarsIterator<Item = <&'a ChunkedArray<ListType> as IntoIterator>::Item> + 'a, Global>
type IntoIter = Box<dyn PolarsIterator<Item = <&'a ChunkedArray<ListType> as IntoIterator>::Item> + 'a, Global>
Which kind of iterator are we turning this into?
sourceimpl IntoSeries for ListChunked
impl IntoSeries for ListChunked
sourceimpl<'a> IntoTakeRandom<'a> for &'a ListChunked
impl<'a> IntoTakeRandom<'a> for &'a ListChunked
type Item = Series
type TakeRandom = TakeRandBranch2<ListTakeRandomSingleChunk<'a>, ListTakeRandom<'a>>
sourcefn take_rand(&self) -> Self::TakeRandom
fn take_rand(&self) -> Self::TakeRandom
Create a type that implements TakeRandom
.
sourceimpl QuantileAggSeries for ListChunked
impl QuantileAggSeries for ListChunked
sourcefn quantile_as_series(
&self,
_quantile: f64,
_interpol: QuantileInterpolOptions
) -> Result<Series>
fn quantile_as_series(
&self,
_quantile: f64,
_interpol: QuantileInterpolOptions
) -> Result<Series>
Get the quantile of the ChunkedArray as a new Series of length 1.
sourcefn median_as_series(&self) -> Series
fn median_as_series(&self) -> Series
Get the median of the ChunkedArray as a new Series of length 1.
sourceimpl TakeRandom for ListChunked
impl TakeRandom for ListChunked
sourceimpl ValueSize for ListChunked
impl ValueSize for ListChunked
sourcefn get_values_size(&self) -> usize
fn get_values_size(&self) -> usize
Useful for a Utf8 or a List to get underlying value size. During a rechunk this is handy Read more
sourceimpl VarAggSeries for ListChunked
impl VarAggSeries for ListChunked
sourcefn var_as_series(&self) -> Series
fn var_as_series(&self) -> Series
Get the variance of the ChunkedArray as a new Series of length 1.
sourcefn std_as_series(&self) -> Series
fn std_as_series(&self) -> Series
Get the standard deviation of the ChunkedArray as a new Series of length 1.