polars_core::datatypes

Type Alias ListChunked

Source
pub type ListChunked = ChunkedArray<ListType>;

Aliased Type§

struct ListChunked { /* private fields */ }

Implementations§

Source§

impl ListChunked

Source

pub fn full_null_with_dtype( name: PlSmallStr, length: usize, inner_dtype: &DataType, ) -> ListChunked

Source§

impl ListChunked

Source

pub fn par_iter(&self) -> impl ParallelIterator<Item = Option<Series>> + '_

Source

pub fn par_iter_indexed( &mut self, ) -> impl IndexedParallelIterator<Item = Option<Series>> + '_

Source§

impl ListChunked

Source

pub fn to_ndarray<N>(&self) -> PolarsResult<Array2<N::Native>>

Available on crate feature ndarray only.

If all nested Series have the same length, a 2 dimensional ndarray::Array is returned.

Source§

impl ListChunked

Source

pub fn amortized_iter( &self, ) -> AmortizedListIter<'_, impl Iterator<Item = Option<ArrayBox>> + '_>

This is an iterator over a ListChunked that saves allocations. A Series is: 1. Arc<ChunkedArray> ChunkedArray is: 2. Vec< 3. ArrayRef>

The ArrayRef we indicated with 3. will be updated during iteration. The Series will be pinned in memory, saving an allocation for

  1. Arc<..>
  2. Vec<…>

If the returned AmortSeries is cloned, the local copy will be replaced and a new container will be set.

Source

pub fn amortized_iter_with_name( &self, name: PlSmallStr, ) -> AmortizedListIter<'_, impl Iterator<Item = Option<ArrayBox>> + '_>

See amortized_iter.

Source

pub fn apply_amortized_generic<F, K, V>(&self, f: F) -> ChunkedArray<V>

Apply a closure F elementwise.

Source

pub fn try_apply_amortized_generic<F, K, V>( &self, f: F, ) -> PolarsResult<ChunkedArray<V>>

Source

pub fn for_each_amortized<F>(&self, f: F)

Source

pub fn zip_and_apply_amortized<'a, T, I, F>( &'a self, ca: &'a ChunkedArray<T>, f: F, ) -> Self
where T: PolarsDataType, &'a ChunkedArray<T>: IntoIterator<IntoIter = I>, I: TrustedLen<Item = Option<T::Physical<'a>>>, F: FnMut(Option<AmortSeries>, Option<T::Physical<'a>>) -> Option<Series>,

Zip with a ChunkedArray then apply a binary function F elementwise.

Source

pub fn binary_zip_and_apply_amortized<'a, T, U, F>( &'a self, ca1: &'a ChunkedArray<T>, ca2: &'a ChunkedArray<U>, f: F, ) -> Self

Source

pub fn try_zip_and_apply_amortized<'a, T, I, F>( &'a self, ca: &'a ChunkedArray<T>, f: F, ) -> PolarsResult<Self>
where T: PolarsDataType, &'a ChunkedArray<T>: IntoIterator<IntoIter = I>, I: TrustedLen<Item = Option<T::Physical<'a>>>, F: FnMut(Option<AmortSeries>, Option<T::Physical<'a>>) -> PolarsResult<Option<Series>>,

Source

pub fn apply_amortized<F>(&self, f: F) -> Self
where F: FnMut(AmortSeries) -> Series,

Apply a closure F elementwise.

Source

pub fn try_apply_amortized<F>(&self, f: F) -> PolarsResult<Self>

Source§

impl ListChunked

Source

pub fn inner_dtype(&self) -> &DataType

Get the inner data type of the list.

Source

pub fn set_inner_dtype(&mut self, dtype: DataType)

Source

pub fn set_fast_explode(&mut self)

Source

pub fn _can_fast_explode(&self) -> bool

Source

pub unsafe fn to_logical(&mut self, inner_dtype: DataType)

Set the logical type of the ListChunked.

§Safety

The caller must ensure that the logical type given fits the physical type of the array.

Source

pub fn to_physical_repr(&self) -> Cow<'_, ListChunked>

Convert the datatype of the list into the physical datatype.

Source

pub unsafe fn from_physical_unchecked( &self, to_inner_dtype: DataType, ) -> PolarsResult<ListChunked>

Convert a non-logical ListChunked back into a logical ListChunked without casting.

§Safety

This can lead to invalid memory access in downstream code.

Source

pub fn get_inner(&self) -> Series

Get the inner values as Series, ignoring the list offsets.

Source

pub fn apply_to_inner( &self, func: &dyn Fn(Series) -> PolarsResult<Series>, ) -> PolarsResult<ListChunked>

Ignore the list indices and apply func to the inner type as Series.

Source

pub fn rechunk_and_trim_to_normalized_offsets(&self) -> Self

Source§

impl ListChunked

Source

pub fn get_as_series(&self, idx: usize) -> Option<Series>

Trait Implementations§

Source§

impl AggList for ListChunked

Available on crate feature algorithm_group_by only.
Source§

unsafe fn agg_list(&self, groups: &GroupsType) -> Series

Safety Read more
Source§

impl ChunkAnyValue for ListChunked

Source§

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
Source§

fn get_any_value(&self, index: usize) -> PolarsResult<AnyValue<'_>>

Get a single value. Beware this is slow.
Source§

impl<'a> ChunkApply<'a, Series> for ListChunked

Source§

fn apply_values<F>(&'a self, f: F) -> Self
where F: Fn(Series) -> Series + Copy,

Apply a closure F elementwise.

Source§

type FuncRet = Series

Source§

fn apply<F>(&'a self, f: F) -> Self
where F: Fn(Option<Series>) -> Option<Series> + Copy,

Apply a closure elementwise including null values.
Source§

fn apply_to_slice<F, T>(&'a self, f: F, slice: &mut [T])
where F: Fn(Option<Series>, &T) -> T,

Apply a closure elementwise and write results to a mutable slice.
Source§

impl ChunkCast for ListChunked

We cannot cast anything to or from List/LargeList So this implementation casts the inner type

Source§

fn cast_with_options( &self, dtype: &DataType, options: CastOptions, ) -> PolarsResult<Series>

Source§

unsafe fn cast_unchecked(&self, dtype: &DataType) -> PolarsResult<Series>

Does not check if the cast is a valid one and may over/underflow Read more
Source§

fn cast(&self, dtype: &DataType) -> PolarsResult<Series>

Source§

impl ChunkCompareEq<&ChunkedArray<ListType>> for ListChunked

Source§

type Item = ChunkedArray<BooleanType>

Source§

fn equal(&self, rhs: &ListChunked) -> BooleanChunked

Check for equality.
Source§

fn equal_missing(&self, rhs: &ListChunked) -> BooleanChunked

Check for equality where None == None.
Source§

fn not_equal(&self, rhs: &ListChunked) -> BooleanChunked

Check for inequality.
Source§

fn not_equal_missing(&self, rhs: &ListChunked) -> BooleanChunked

Check for inequality where None == None.
Source§

impl ChunkExpandAtIndex<ListType> for ListChunked

Source§

fn new_from_index(&self, index: usize, length: usize) -> ListChunked

Create a new ChunkedArray filled with values at that index.
Source§

impl ChunkExplode for ListChunked

Source§

fn offsets(&self) -> PolarsResult<OffsetsBuffer<i64>>

Source§

fn explode_and_offsets(&self) -> PolarsResult<(Series, OffsetsBuffer<i64>)>

Source§

fn explode(&self) -> PolarsResult<Series>

Source§

impl ChunkFull<&Series> for ListChunked

Source§

fn full(name: PlSmallStr, value: &Series, length: usize) -> ListChunked

Create a ChunkedArray with a single value.
Source§

impl ChunkFullNull for ListChunked

Source§

impl ChunkQuantile<Series> for ListChunked

Source§

fn median(&self) -> Option<T>

Returns the mean value in the array. Returns None if the array is empty or only contains null values.
Source§

fn quantile( &self, _quantile: f64, _method: QuantileMethod, ) -> PolarsResult<Option<T>>

Aggregate a given quantile of the ChunkedArray. Returns None if the array is empty or only contains null values.
Source§

impl ChunkReverse for ListChunked

Source§

fn reverse(&self) -> Self

Return a reversed version of this array.
Source§

impl ChunkShift<ListType> for ListChunked

Source§

fn shift(&self, periods: i64) -> Self

Source§

impl ChunkShiftFill<ListType, Option<&Series>> for ListChunked

Source§

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.
Source§

impl ChunkTakeUnchecked<ChunkedArray<UInt32Type>> for ListChunked

Source§

unsafe fn take_unchecked(&self, indices: &IdxCa) -> Self

Gather values from ChunkedArray by index. Read more
Source§

impl<I: AsRef<[IdxSize]> + ?Sized> ChunkTakeUnchecked<I> for ListChunked

Source§

unsafe fn take_unchecked(&self, indices: &I) -> Self

Gather values from ChunkedArray by index. Read more
Source§

impl ChunkVar for ListChunked

Source§

fn var(&self, _ddof: u8) -> Option<f64>

Compute the variance of this ChunkedArray/Series.
Source§

fn std(&self, _ddof: u8) -> Option<f64>

Compute the standard deviation of this ChunkedArray/Series.
Source§

impl Debug for ListChunked

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromIterator<Option<Box<dyn Array>>> for ListChunked

Source§

fn from_iter<I: IntoIterator<Item = Option<Box<dyn Array>>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<Option<Column>> for ListChunked

Source§

fn from_iter<T: IntoIterator<Item = Option<Column>>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<Option<Series>> for ListChunked

Source§

fn from_iter<I: IntoIterator<Item = Option<Series>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<Ptr> FromIterator<Ptr> for ListChunked
where Ptr: Borrow<Series>,

Source§

fn from_iter<I: IntoIterator<Item = Ptr>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromParIterWithDtype<Option<Series>> for ListChunked

Source§

fn from_par_iter_with_dtype<I>( iter: I, name: PlSmallStr, dtype: DataType, ) -> Self
where I: IntoParallelIterator<Item = Option<Series>>, Self: Sized,

Source§

impl FromParallelIterator<Option<Series>> for ListChunked

Source§

fn from_par_iter<I>(par_iter: I) -> Self
where I: IntoParallelIterator<Item = Option<Series>>,

Creates an instance of the collection from the parallel iterator par_iter. Read more
Source§

impl FromTrustedLenIterator<Option<Series>> for ListChunked

Source§

fn from_iter_trusted_length<I: IntoIterator<Item = Option<Series>>>( iter: I, ) -> Self

Source§

impl<Ptr> FromTrustedLenIterator<Ptr> for ListChunked
where Ptr: Borrow<Series>,

Source§

fn from_iter_trusted_length<I: IntoIterator<Item = Ptr>>(iter: I) -> Self

Source§

impl IntoGroupsType for ListChunked

Available on crate feature algorithm_group_by only.
Source§

fn group_tuples<'a>( &'a self, multithreaded: bool, sorted: bool, ) -> PolarsResult<GroupsType>

Create the tuples need for a group_by operation. * The first value in the tuple is the first index of the group. * The second value in the tuple is the indexes of the groups including the first value.
Source§

impl<'a> IntoIterator for &'a ListChunked

Source§

type Item = Option<Series>

The type of the elements being iterated over.
Source§

type IntoIter = Box<dyn PolarsIterator<Item = <&'a ChunkedArray<ListType> as IntoIterator>::Item> + 'a>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl Serialize for ListChunked

Available on crate feature serde only.
Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ValueSize for ListChunked

Source§

fn get_values_size(&self) -> usize

Get the values size that is still “visible” to the underlying array. E.g. take the offsets into account.