polars_core::datatypes

Type Alias ArrayChunked

Source
pub type ArrayChunked = ChunkedArray<FixedSizeListType>;
Available on crate feature dtype-array only.

Aliased Type§

struct ArrayChunked { /* private fields */ }

Implementations§

Source§

impl ArrayChunked

Source

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

Source§

impl ArrayChunked

Source

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

This is an iterator over a ArrayChunked that save 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<…>
§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.

§Safety

The lifetime of AmortSeries is bound to the iterator. Keeping it alive longer than the iterator is UB.

Source

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

This is an iterator over a ArrayChunked that save 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 try_apply_amortized_to_list<F>(&self, f: F) -> PolarsResult<ListChunked>

Source

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

Apply a closure F to each array.

§Safety

Return series of F must has the same dtype and number of elements as input.

Source

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

Try apply a closure F to each array.

§Safety

Return series of F must has the same dtype and number of elements as input if it is Ok.

Source

pub unsafe fn zip_and_apply_amortized_same_type<'a, T, F>( &'a self, ca: &'a ChunkedArray<T>, f: F, ) -> Self

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

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

Try apply a closure F elementwise.

Source

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

Source§

impl ArrayChunked

Source

pub fn inner_dtype(&self) -> &DataType

Get the inner data type of the fixed size list.

Source

pub fn width(&self) -> usize

Source

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

§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<'_, ArrayChunked>

Convert the datatype of the array into the physical datatype.

Source

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

Convert a non-logical ArrayChunked back into a logical ArrayChunked 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

Source

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

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

Source

pub fn get_leaf_array(&self) -> Series

Recurse nested types until we are at the leaf array.

Source§

impl ArrayChunked

Source

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

Trait Implementations§

Source§

impl AggList for ArrayChunked

Available on crate feature algorithm_group_by only.
Source§

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

Safety Read more
Source§

impl ChunkAnyValue for ArrayChunked

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 ChunkCast for ArrayChunked

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<FixedSizeListType>> for ArrayChunked

Source§

type Item = ChunkedArray<BooleanType>

Source§

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

Check for equality.
Source§

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

Check for equality where None == None.
Source§

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

Check for inequality.
Source§

fn not_equal_missing(&self, rhs: &ArrayChunked) -> Self::Item

Check for inequality where None == None.
Source§

impl ChunkExpandAtIndex<FixedSizeListType> for ArrayChunked

Source§

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

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

impl ChunkExplode for ArrayChunked

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 ArrayChunked

Source§

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

Create a ChunkedArray with a single value.
Source§

impl ChunkFullNull for ArrayChunked

Source§

impl ChunkQuantile<Series> for ArrayChunked

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 ArrayChunked

Source§

fn reverse(&self) -> Self

Return a reversed version of this array.
Source§

impl ChunkShift<FixedSizeListType> for ArrayChunked

Source§

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

Source§

impl ChunkShiftFill<FixedSizeListType, Option<&Series>> for ArrayChunked

Source§

fn shift_and_fill( &self, periods: i64, fill_value: Option<&Series>, ) -> ArrayChunked

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 ArrayChunked

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 ArrayChunked

Source§

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

Gather values from ChunkedArray by index. Read more
Source§

impl ChunkVar for ArrayChunked

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 ArrayChunked

Source§

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

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

impl IntoGroupsType for ArrayChunked

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 ArrayChunked

Source§

type Item = Option<Series>

The type of the elements being iterated over.
Source§

type IntoIter = Box<dyn PolarsIterator<Item = <&'a ChunkedArray<FixedSizeListType> 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 ArrayChunked

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 ArrayChunked

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.