Struct polars_core::chunked_array::ChunkedArray

source ·
pub struct ChunkedArray<T: PolarsDataType> { /* private fields */ }
Expand description

§ChunkedArray

Every Series contains a ChunkedArray<T>. Unlike Series, ChunkedArrays are typed. This allows us to apply closures to the data and collect the results to a ChunkedArray of the same type T. Below we use an apply to use the cosine function to the values of a ChunkedArray.

fn apply_cosine_and_cast(ca: &Float32Chunked) -> Float64Chunked {
    ca.apply_values_generic(|v| v.cos() as f64)
}

§Conversion between Series and ChunkedArray’s

Conversion from a Series to a ChunkedArray is effortless.

fn to_chunked_array(series: &Series) -> PolarsResult<&Int32Chunked>{
    series.i32()
}

fn to_series(ca: Int32Chunked) -> Series {
    ca.into_series()
}

§Iterators

ChunkedArrays fully support Rust native Iterator and DoubleEndedIterator traits, thereby giving access to all the excellent methods available for Iterators.


fn iter_forward(ca: &Float32Chunked) {
    ca.iter()
        .for_each(|opt_v| println!("{:?}", opt_v))
}

fn iter_backward(ca: &Float32Chunked) {
    ca.iter()
        .rev()
        .for_each(|opt_v| println!("{:?}", opt_v))
}

§Memory layout

ChunkedArrays use Apache Arrow as backend for the memory layout. Arrows memory is immutable which makes it possible to make multiple zero copy (sub)-views from a single array.

To be able to append data, Polars uses chunks to append new memory locations, hence the ChunkedArray<T> data structure. Appends are cheap, because it will not lead to a full reallocation of the whole array (as could be the case with a Rust Vec).

However, multiple chunks in a ChunkedArray will slow down many operations that need random access because we have an extra indirection and indexes need to be mapped to the proper chunk. Arithmetic may also be slowed down by this. When multiplying two ChunkedArrays with different chunk sizes they cannot utilize SIMD for instance.

If you want to have predictable performance (no unexpected re-allocation of memory), it is advised to call the ChunkedArray::rechunk after multiple append operations.

See also ChunkedArray::extend for appends within a chunk.

§Invariants

Implementations§

source§

impl ChunkedArray<BooleanType>

Booleans are cast to 1 or 0.

source

pub fn sum(&self) -> Option<IdxSize>

source

pub fn min(&self) -> Option<bool>

source

pub fn max(&self) -> Option<bool>

source

pub fn mean(&self) -> Option<f64>

source§

impl<T> ChunkedArray<T>
where T: PolarsDataType<IsNested = FalseT>, for<'a> T::Physical<'a>: TotalOrd,

source

pub fn append(&mut self, other: &Self)

Append in place. This is done by adding the chunks of other to this ChunkedArray.

See also extend for appends to the underlying memory

source§

impl<T> ChunkedArray<T>
where T: PolarsDataType,

source

pub fn apply_values_generic<'a, U, K, F>(&'a self, op: F) -> ChunkedArray<U>
where U: PolarsDataType, F: FnMut(T::Physical<'a>) -> K, U::Array: ArrayFromIter<K>,

source

pub fn apply_nonnull_values_generic<'a, U, K, F>( &'a self, dtype: DataType, op: F ) -> ChunkedArray<U>

Applies a function only to the non-null elements, propagating nulls.

source

pub fn try_apply_nonnull_values_generic<'a, U, K, F, E>( &'a self, op: F ) -> Result<ChunkedArray<U>, E>
where U: PolarsDataType, F: FnMut(T::Physical<'a>) -> Result<K, E>, U::Array: ArrayFromIter<K> + ArrayFromIter<Option<K>>,

Applies a function only to the non-null elements, propagating nulls.

source

pub fn apply_generic<'a, U, K, F>(&'a self, op: F) -> ChunkedArray<U>
where U: PolarsDataType, F: FnMut(Option<T::Physical<'a>>) -> Option<K>, U::Array: ArrayFromIter<Option<K>>,

source

pub fn try_apply_generic<'a, U, K, F, E>( &'a self, op: F ) -> Result<ChunkedArray<U>, E>
where U: PolarsDataType, F: FnMut(Option<T::Physical<'a>>) -> Result<Option<K>, E> + Copy, U::Array: ArrayFromIter<Option<K>>,

source§

impl<T: PolarsNumericType> ChunkedArray<T>

source

pub fn cast_and_apply_in_place<F, S>(&self, f: F) -> ChunkedArray<S>
where F: Fn(S::Native) -> S::Native + Copy, S: PolarsNumericType,

Cast a numeric array to another numeric data type and apply a function in place. This saves an allocation.

source

pub fn apply_in_place<F>(self, f: F) -> Self
where F: Fn(T::Native) -> T::Native + Copy,

Cast a numeric array to another numeric data type and apply a function in place. This saves an allocation.

source§

impl<T: PolarsNumericType> ChunkedArray<T>

source

pub fn apply_mut<F>(&mut self, f: F)
where F: Fn(T::Native) -> T::Native + Copy,

source§

impl ChunkedArray<StringType>

source

pub fn apply_mut<'a, F>(&'a self, f: F) -> Self
where F: FnMut(&'a str) -> &'a str,

source

pub fn apply_to_buffer<'a, F>(&'a self, f: F) -> Self
where F: FnMut(&'a str, &mut String),

Utility that reuses an string buffer to amortize allocations. Prefer this over an apply that returns an owned String.

source§

impl ChunkedArray<BinaryType>

source

pub fn apply_mut<'a, F>(&'a self, f: F) -> Self
where F: FnMut(&'a [u8]) -> &'a [u8],

source§

impl ChunkedArray<Float32Type>

Used to save compilation paths. Use carefully. Although this is safe, if misused it can lead to incorrect results.

source

pub fn apply_as_ints<F>(&self, f: F) -> Series
where F: Fn(&Series) -> Series,

source§

impl ChunkedArray<Float64Type>

source

pub fn apply_as_ints<F>(&self, f: F) -> Series
where F: Fn(&Series) -> Series,

source§

impl<T: PolarsDataType> ChunkedArray<T>

source

pub fn len(&self) -> usize

Get the length of the ChunkedArray

source

pub fn null_count(&self) -> usize

Return the number of null values in the ChunkedArray.

source

pub unsafe fn set_null_count(&mut self, null_count: IdxSize)

Set the null count directly.

This can be useful after mutably adjusting the validity of the underlying arrays.

§Safety

The new null count must match the total null count of the underlying arrays.

source

pub fn is_empty(&self) -> bool

Check if ChunkedArray is empty.

source

pub fn rechunk(&self) -> Self

source

pub fn slice(&self, offset: i64, length: usize) -> Self

Slice the array. The chunks are reallocated the underlying data slices are zero copy.

When offset is negative it will be counted from the end of the array. This method will never error, and will slice the best match when offset, or length is out of bounds

source

pub fn limit(&self, num_elements: usize) -> Self
where Self: Sized,

Take a view of top n elements

source

pub fn head(&self, length: Option<usize>) -> Self
where Self: Sized,

Get the head of the ChunkedArray

source

pub fn tail(&self, length: Option<usize>) -> Self
where Self: Sized,

Get the tail of the ChunkedArray

source

pub fn prune_empty_chunks(&mut self)

Remove empty chunks.

source§

impl ChunkedArray<StringType>

source

pub fn to_decimal(&self, infer_length: usize) -> PolarsResult<Series>

Available on crate feature dtype-decimal only.

Convert an StringChunked to a Series of DataType::Decimal. Scale needed for the decimal type are inferred. Parsing is not strict.
Scale inference assumes that all tested strings are well-formed numbers, and may produce unexpected results for scale if this is not the case.

If the decimal precision and scale are already known, consider using the cast method.

source§

impl<T> ChunkedArray<T>

source

pub fn extend(&mut self, other: &Self)

Extend the memory backed by this array with the values from other.

Different from ChunkedArray::append which adds chunks to this ChunkedArray extend appends the data from other to the underlying PrimitiveArray and thus may cause a reallocation.

However if this does not cause a reallocation, the resulting data structure will not have any extra chunks and thus will yield faster queries.

Prefer extend over append when you want to do a query after a single append. For instance during online operations where you add n rows and rerun a query.

Prefer append over extend when you want to append many times before doing a query. For instance when you read in multiple files and when to store them in a single DataFrame. In the latter case finish the sequence of append operations with a rechunk.

source§

impl<T> ChunkedArray<T>
where T: PolarsDataType,

source

pub fn for_each<'a, F>(&'a self, op: F)
where F: FnMut(Option<T::Physical<'a>>),

source§

impl ChunkedArray<ListType>

source

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

source§

impl ChunkedArray<UInt32Type>

source

pub fn with_nullable_idx<T, F: FnOnce(&IdxCa) -> T>( idx: &[NullableIdxSize], f: F ) -> T

source§

impl<T: PolarsDataType> ChunkedArray<T>

source

pub fn is_null(&self) -> BooleanChunked

Get a mask of the null values.

source

pub fn is_not_null(&self) -> BooleanChunked

Get a mask of the valid values.

source§

impl<T> ChunkedArray<T>

source

pub fn rolling_map_float<F>( &self, window_size: usize, f: F ) -> PolarsResult<Self>
where F: FnMut(&mut ChunkedArray<T>) -> Option<T::Native>,

Available on crate feature rolling_window only.

Apply a rolling custom function. This is pretty slow because of dynamic dispatch.

source§

impl ChunkedArray<BinaryType>

source

pub unsafe fn to_string_unchecked(&self) -> StringChunked

§Safety

String is not validated

source§

impl ChunkedArray<StringType>

source§

impl ChunkedArray<BooleanType>

source

pub fn any(&self) -> bool

Returns whether any of the values in the column are true.

Null values are ignored.

source

pub fn all(&self) -> bool

Returns whether all values in the array are true.

Null values are ignored.

source

pub fn any_kleene(&self) -> Option<bool>

Returns whether any of the values in the column are true.

The output is unknown (None) if the array contains any null values and no true values.

source

pub fn all_kleene(&self) -> Option<bool>

Returns whether all values in the column are true.

The output is unknown (None) if the array contains any null values and no false values.

source§

impl<T> ChunkedArray<T>

source

pub fn is_nan(&self) -> BooleanChunked

source

pub fn is_not_nan(&self) -> BooleanChunked

source

pub fn is_finite(&self) -> BooleanChunked

source

pub fn is_infinite(&self) -> BooleanChunked

source

pub fn none_to_nan(&self) -> Self

Convert missing values to NaN values.

source§

impl<T> ChunkedArray<T>

source

pub fn to_canonical(&self) -> Self

source§

impl ChunkedArray<ListType>

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 ChunkedArray<StringType>

source

pub fn par_iter_indexed( &self ) -> impl IndexedParallelIterator<Item = Option<&str>>

source

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

source§

impl<T> ChunkedArray<T>
where T: PolarsDataType,

source

pub fn iter(&self) -> impl PolarsIterator<Item = Option<T::Physical<'_>>>

source§

impl<T> ChunkedArray<T>

source

pub fn to_ndarray(&self) -> PolarsResult<ArrayView1<'_, T::Native>>

Available on crate feature ndarray only.

If data is aligned in a single chunk and has no Null values a zero copy view is returned as an ndarray

source§

impl ChunkedArray<ListType>

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<T> ChunkedArray<T>
where T: PolarsDataType, for<'a> <T::Array as StaticArray>::ValueT<'a>: AsRef<[u8]>,

source

pub fn to_bytes_hashes<'a>( &'a self, multithreaded: bool, hb: RandomState ) -> Vec<Vec<BytesHash<'a>>>

source§

impl<T> ChunkedArray<T>
where T: PolarsDataType,

source

pub fn with_chunk<A>(name: &str, arr: A) -> Self
where A: Array, T: PolarsDataType<Array = A>,

source

pub fn with_chunk_like<A>(ca: &Self, arr: A) -> Self
where A: Array, T: PolarsDataType<Array = A>,

source

pub fn from_chunk_iter<I>(name: &str, iter: I) -> Self
where I: IntoIterator, T: PolarsDataType<Array = <I as IntoIterator>::Item>, <I as IntoIterator>::Item: Array,

source

pub fn from_chunk_iter_like<I>(ca: &Self, iter: I) -> Self
where I: IntoIterator, T: PolarsDataType<Array = <I as IntoIterator>::Item>, <I as IntoIterator>::Item: Array,

source

pub fn try_from_chunk_iter<I, A, E>(name: &str, iter: I) -> Result<Self, E>
where I: IntoIterator<Item = Result<A, E>>, T: PolarsDataType<Array = A>, A: Array,

source

pub unsafe fn from_chunks(name: &str, chunks: Vec<ArrayRef>) -> Self

Create a new ChunkedArray from existing chunks.

§Safety

The Arrow datatype of all chunks must match the PolarsDataType T.

source

pub unsafe fn with_chunks(&self, chunks: Vec<ArrayRef>) -> Self

§Safety

The Arrow datatype of all chunks must match the PolarsDataType T.

source

pub unsafe fn from_chunks_and_dtype( name: &str, chunks: Vec<ArrayRef>, dtype: DataType ) -> Self

Create a new ChunkedArray from existing chunks.

§Safety

The Arrow datatype of all chunks must match the PolarsDataType T.

source

pub fn full_null_like(ca: &Self, length: usize) -> Self

source§

impl<T> ChunkedArray<T>

source

pub fn from_vec(name: &str, v: Vec<T::Native>) -> Self

Create a new ChunkedArray by taking ownership of the Vec. This operation is zero copy.

source

pub fn from_vec_validity( name: &str, values: Vec<T::Native>, buffer: Option<Bitmap> ) -> Self

Create a new ChunkedArray from a Vec and a validity mask.

source

pub unsafe fn mmap_slice(name: &str, values: &[T::Native]) -> Self

Create a temporary ChunkedArray from a slice.

§Safety

The lifetime will be bound to the lifetime of the slice. This will not be checked by the borrowchecker.

source§

impl ChunkedArray<BooleanType>

source

pub unsafe fn mmap_slice( name: &str, values: &[u8], offset: usize, len: usize ) -> Self

Create a temporary ChunkedArray from a slice.

§Safety

The lifetime will be bound to the lifetime of the slice. This will not be checked by the borrowchecker.

source§

impl ChunkedArray<ListType>

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: &str ) -> 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 ChunkedArray<ListType>

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 get_inner(&self) -> Series

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

source

pub fn iter_offsets(&self) -> impl Iterator<Item = i64> + '_

Returns an iterator over the offsets of this chunked array.

The offsets are returned as though the array consisted of a single chunk.

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§

impl ChunkedArray<Int128Type>

source

pub fn into_decimal_unchecked( self, precision: Option<usize>, scale: usize ) -> DecimalChunked

Available on crate feature dtype-decimal only.
source

pub fn into_decimal( self, precision: Option<usize>, scale: usize ) -> PolarsResult<DecimalChunked>

Available on crate feature dtype-decimal only.
source§

impl<T> ChunkedArray<ObjectType<T>>
where T: PolarsObject,

source

pub fn new_from_vec(name: &str, v: Vec<T>) -> Self

Available on crate feature object only.
source

pub fn new_from_vec_and_validity( name: &str, v: Vec<T>, validity: Bitmap ) -> Self

Available on crate feature object only.
source

pub fn new_empty(name: &str) -> Self

Available on crate feature object only.
source§

impl<T> ChunkedArray<ObjectType<T>>
where T: PolarsObject,

source

pub unsafe fn get_object_unchecked( &self, index: usize ) -> Option<&dyn PolarsObjectSafe>

Available on crate feature object only.

Get a hold to an object that can be formatted or downcasted via the Any trait.

§Safety

No bounds checks

source

pub fn get_object(&self, index: usize) -> Option<&dyn PolarsObjectSafe>

Available on crate feature object only.

Get a hold to an object that can be formatted or downcasted via the Any trait.

source§

impl<T> ChunkedArray<T>

source

pub fn init_rand(size: usize, null_density: f32, seed: Option<u64>) -> Self

Available on crate feature random only.
source§

impl<T> ChunkedArray<T>

source

pub fn sample_n( &self, n: usize, with_replacement: bool, shuffle: bool, seed: Option<u64> ) -> PolarsResult<Self>

Available on crate feature random only.

Sample n datapoints from this ChunkedArray.

source

pub fn sample_frac( &self, frac: f64, with_replacement: bool, shuffle: bool, seed: Option<u64> ) -> PolarsResult<Self>

Available on crate feature random only.

Sample a fraction between 0.0-1.0 of this ChunkedArray.

source§

impl<T> ChunkedArray<T>

source

pub fn rand_normal( name: &str, length: usize, mean: f64, std_dev: f64 ) -> PolarsResult<Self>

Available on crate feature random only.

Create ChunkedArray with samples from a Normal distribution.

source

pub fn rand_standard_normal(name: &str, length: usize) -> Self

Available on crate feature random only.

Create ChunkedArray with samples from a Standard Normal distribution.

source

pub fn rand_uniform(name: &str, length: usize, low: f64, high: f64) -> Self

Available on crate feature random only.

Create ChunkedArray with samples from a Uniform distribution.

source§

impl ChunkedArray<BooleanType>

source

pub fn rand_bernoulli(name: &str, length: usize, p: f64) -> PolarsResult<Self>

Available on crate feature random only.

Create ChunkedArray with samples from a Bernoulli distribution.

source§

impl<T: PolarsNumericType> ChunkedArray<T>

source

pub fn to_vec(&self) -> Vec<Option<T::Native>>

Convert to a Vec of Option<T::Native>.

source

pub fn to_vec_null_aware( &self ) -> Either<Vec<T::Native>, Vec<Option<T::Native>>>

Convert to a Vec but don’t return Option<T::Native> if there are no null values

source§

impl<T: PolarsDataType> ChunkedArray<T>

source

pub fn new_with_compute_len(field: Arc<Field>, chunks: Vec<ArrayRef>) -> Self

Create a new ChunkedArray and compute its length and null_count.

If you want to explicitly the length and null_count, look at ChunkedArray::new_with_dims

source

pub unsafe fn new_with_dims( field: Arc<Field>, chunks: Vec<ArrayRef>, length: IdxSize, null_count: IdxSize ) -> Self

Create a new ChunkedArray and explicitly set its length and null_count.

If you want to compute the length and null_count, look at ChunkedArray::new_with_compute_len

§Safety

The length and null_count must be correct.

source

pub fn effective_metadata(&self) -> &Metadata<T>

Get a reference to the used Metadata

This results a reference to an empty Metadata if its unset for this ChunkedArray.

source

pub fn metadata(&self) -> Option<&Metadata<T>>

Get a reference to the ChunkedArray’s Metadata

source

pub fn metadata_arc(&self) -> Option<&Arc<Metadata<T>>>

Get a reference to Arc that contains the ChunkedArray’s Metadata

source

pub fn metadata_owned_arc(&self) -> Arc<Metadata<T>>

Get a Arc that contains the ChunkedArray’s Metadata

source

pub fn metadata_mut(&mut self) -> &mut Arc<Metadata<T>>

Get a mutable reference to the Arc that contains the ChunkedArray’s Metadata

source

pub fn unset_fast_explode_list(&mut self)

source

pub fn set_fast_explode_list(&mut self, value: bool)

source

pub fn get_fast_explode_list(&self) -> bool

source

pub fn get_flags(&self) -> MetadataFlags

source

pub fn is_sorted_flag(&self) -> IsSorted

source

pub fn set_sorted_flag(&mut self, sorted: IsSorted)

Set the ‘sorted’ bit meta info.

source

pub fn with_sorted_flag(&self, sorted: IsSorted) -> Self

Set the ‘sorted’ bit meta info.

source

pub fn get_min_value(&self) -> Option<&T::OwnedPhysical>

source

pub fn get_max_value(&self) -> Option<&T::OwnedPhysical>

source

pub fn get_distinct_count(&self) -> Option<IdxSize>

source

pub fn merge_metadata(&mut self, md: Metadata<T>)

source

pub fn copy_metadata_cast<O: PolarsDataType>( &mut self, other: &ChunkedArray<O>, props: MetadataProperties )

Copies Metadata properties specified by props from other with different underlying PolarsDataType into self.

This does not copy the properties with a different type between the Metadatas (e.g. min_value and max_value) and will panic on debug builds if that is attempted.

source

pub fn copy_metadata(&mut self, other: &Self, props: MetadataProperties)

Copies Metadata properties specified by props from other into self.

source

pub fn first_non_null(&self) -> Option<usize>

Get the index of the first non null value in this ChunkedArray.

source

pub fn last_non_null(&self) -> Option<usize>

Get the index of the last non null value in this ChunkedArray.

source

pub fn drop_nulls(&self) -> Self

source

pub fn iter_validities( &self ) -> Map<Iter<'_, ArrayRef>, fn(_: &ArrayRef) -> Option<&Bitmap>>

Get the buffer of bits representing null values

source

pub fn has_validity(&self) -> bool

Return if any the chunks in this ChunkedArray have a validity bitmap. no bitmap means no null values.

source

pub fn shrink_to_fit(&mut self)

Shrink the capacity of this array to fit its length.

source

pub fn clear(&self) -> Self

source

pub fn unpack_series_matching_type( &self, series: &Series ) -> PolarsResult<&ChunkedArray<T>>

Series to ChunkedArray<T>

source

pub fn chunk_lengths(&self) -> ChunkLenIter<'_>

Returns an iterator over the lengths of the chunks of the array.

source

pub fn chunks(&self) -> &Vec<ArrayRef>

A reference to the chunks

source

pub unsafe fn chunks_mut(&mut self) -> &mut Vec<ArrayRef>

A mutable reference to the chunks

§Safety

The caller must ensure to not change the DataType or length of any of the chunks. And the null_count remains correct.

source

pub fn is_optimal_aligned(&self) -> bool

Returns true if contains a single chunk and has no null values

source

pub fn dtype(&self) -> &DataType

Get data type of ChunkedArray.

source

pub fn name(&self) -> &str

Name of the ChunkedArray.

source

pub fn ref_field(&self) -> &Field

Get a reference to the field.

source

pub fn rename(&mut self, name: &str)

Rename this ChunkedArray.

source

pub fn with_name(self, name: &str) -> Self

Return this ChunkedArray with a new name.

source§

impl<T> ChunkedArray<T>
where T: PolarsDataType,

source

pub fn get(&self, idx: usize) -> Option<T::Physical<'_>>

Get a single value from this ChunkedArray. If the return values is None this indicates a NULL value.

§Panics

This function will panic if idx is out of bounds.

source

pub unsafe fn get_unchecked(&self, idx: usize) -> Option<T::Physical<'_>>

Get a single value from this ChunkedArray. If the return values is None this indicates a NULL value.

§Safety

It is the callers responsibility that the idx < self.len().

source

pub unsafe fn value_unchecked(&self, idx: usize) -> T::Physical<'_>

Get a single value from this ChunkedArray. Null values are ignored and the returned value could be garbage if it was masked out by NULL. Note that the value always is initialized.

§Safety

It is the callers responsibility that the idx < self.len().

source

pub fn last(&self) -> Option<T::Physical<'_>>

source§

impl ChunkedArray<ListType>

source

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

source§

impl<T> ChunkedArray<T>
where T: PolarsDataType,

source

pub fn layout(&self) -> ChunkedArrayLayout<'_, T>

source§

impl<T> ChunkedArray<T>

source

pub fn cont_slice(&self) -> PolarsResult<&[T::Native]>

Returns the values of the array as a contiguous slice.

source

pub fn data_views(&self) -> impl DoubleEndedIterator<Item = &[T::Native]>

Get slices of the underlying arrow data. NOTE: null values should be taken into account by the user of these slices as they are handled separately

source

pub fn into_no_null_iter( &self ) -> impl '_ + Send + Sync + ExactSizeIterator<Item = T::Native> + DoubleEndedIterator + TrustedLen

source§

impl<T> ChunkedArray<T>

source

pub fn group_tuples_perfect( &self, max: usize, multithreaded: bool, group_capacity: usize ) -> GroupsProxy

Available on crate feature algorithm_group_by only.
source§

impl<T: PolarsNumericType> ChunkedArray<T>

source

pub fn new_vec(name: &str, v: Vec<T::Native>) -> Self

Specialization that prevents an allocation prefer this over ChunkedArray::new when you have a Vec<T::Native> and no null values.

source§

impl<T> ChunkedArray<T>

We cannot override the left hand side behaviour. So we create a trait LhsNumOps. This allows for 1.add(&Series)

source

pub fn lhs_sub<N: Num + NumCast>(&self, lhs: N) -> Self

Apply lhs - self

source

pub fn lhs_div<N: Num + NumCast>(&self, lhs: N) -> Self

Apply lhs / self

source

pub fn lhs_rem<N: Num + NumCast>(&self, lhs: N) -> Self

Apply lhs % self

Trait Implementations§

source§

impl<T: PolarsNumericType, N: Num + ToPrimitive> Add<N> for &ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: N) -> Self::Output

Performs the + operation. Read more
source§

impl<T: PolarsNumericType, N: Num + ToPrimitive> Add<N> for ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: N) -> Self::Output

Performs the + operation. Read more
source§

impl<T: PolarsNumericType> Add for &ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl<T: PolarsNumericType> Add for ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl<T> AggList for ChunkedArray<T>

Available on crate feature algorithm_group_by only.
source§

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

Safety Read more
source§

impl<T: PolarsNumericType> ArithmeticChunked for &ChunkedArray<T>

§

type Scalar = <T as PolarsNumericType>::Native

§

type Out = ChunkedArray<T>

§

type TrueDivOut = ChunkedArray<<<T as PolarsNumericType>::Native as NumericNative>::TrueDivPolarsType>

source§

fn wrapping_abs(self) -> Self::Out

source§

fn wrapping_neg(self) -> Self::Out

source§

fn wrapping_add(self, rhs: Self) -> Self::Out

source§

fn wrapping_sub(self, rhs: Self) -> Self::Out

source§

fn wrapping_mul(self, rhs: Self) -> Self::Out

source§

fn wrapping_floor_div(self, rhs: Self) -> Self::Out

source§

fn wrapping_trunc_div(self, rhs: Self) -> Self::Out

source§

fn wrapping_mod(self, rhs: Self) -> Self::Out

source§

fn wrapping_add_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_sub_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_sub_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::Out

source§

fn wrapping_mul_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_floor_div_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_floor_div_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::Out

source§

fn wrapping_trunc_div_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_trunc_div_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::Out

source§

fn wrapping_mod_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_mod_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::Out

source§

fn true_div(self, rhs: Self) -> Self::TrueDivOut

source§

fn true_div_scalar(self, rhs: Self::Scalar) -> Self::TrueDivOut

source§

fn true_div_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::TrueDivOut

source§

fn legacy_div(self, rhs: Self) -> Self::Out

source§

fn legacy_div_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn legacy_div_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::Out

source§

impl<T: PolarsNumericType> ArithmeticChunked for ChunkedArray<T>

§

type Scalar = <T as PolarsNumericType>::Native

§

type Out = ChunkedArray<T>

§

type TrueDivOut = ChunkedArray<<<T as PolarsNumericType>::Native as NumericNative>::TrueDivPolarsType>

source§

fn wrapping_abs(self) -> Self::Out

source§

fn wrapping_neg(self) -> Self::Out

source§

fn wrapping_add(self, rhs: Self) -> Self::Out

source§

fn wrapping_sub(self, rhs: Self) -> Self::Out

source§

fn wrapping_mul(self, rhs: Self) -> Self::Out

source§

fn wrapping_floor_div(self, rhs: Self) -> Self::Out

source§

fn wrapping_trunc_div(self, rhs: Self) -> Self::Out

source§

fn wrapping_mod(self, rhs: Self) -> Self::Out

source§

fn wrapping_add_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_sub_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_sub_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::Out

source§

fn wrapping_mul_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_floor_div_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_floor_div_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::Out

source§

fn wrapping_trunc_div_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_trunc_div_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::Out

source§

fn wrapping_mod_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn wrapping_mod_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::Out

source§

fn true_div(self, rhs: Self) -> Self::TrueDivOut

source§

fn true_div_scalar(self, rhs: Self::Scalar) -> Self::TrueDivOut

source§

fn true_div_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::TrueDivOut

source§

fn legacy_div(self, rhs: Self) -> Self::Out

source§

fn legacy_div_scalar(self, rhs: Self::Scalar) -> Self::Out

source§

fn legacy_div_scalar_lhs(lhs: Self::Scalar, rhs: Self) -> Self::Out

source§

impl<'a, T> AsMut<ChunkedArray<T>> for dyn SeriesTrait + 'a
where T: 'static + PolarsDataType,

source§

fn as_mut(&mut self) -> &mut ChunkedArray<T>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<T: PolarsDataType> AsRef<ChunkedArray<T>> for ChunkedArray<T>

source§

fn as_ref(&self) -> &ChunkedArray<T>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'a, T> AsRef<ChunkedArray<T>> for dyn SeriesTrait + 'a
where T: 'static + PolarsDataType,

source§

fn as_ref(&self) -> &ChunkedArray<T>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T: PolarsDataType> AsRefDataType for ChunkedArray<T>

source§

impl<T> BitAnd for &ChunkedArray<T>
where T: PolarsIntegerType, T::Native: BitAnd<Output = T::Native>,

§

type Output = ChunkedArray<T>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
source§

impl<T> BitOr for &ChunkedArray<T>
where T: PolarsIntegerType, T::Native: BitOr<Output = T::Native>,

§

type Output = ChunkedArray<T>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
source§

impl<T> BitXor for &ChunkedArray<T>
where T: PolarsIntegerType, T::Native: BitXor<Output = T::Native>,

§

type Output = ChunkedArray<T>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
source§

impl<T> ChunkAgg<<T as PolarsNumericType>::Native> for ChunkedArray<T>
where T: PolarsNumericType, PrimitiveArray<T::Native>: for<'a> MinMaxKernel<Scalar<'a> = T::Native>, <T::Native as Simd>::Simd: Add<Output = <T::Native as Simd>::Simd> + Sum<T::Native>,

source§

fn sum(&self) -> Option<T::Native>

Aggregate the sum of the ChunkedArray. Returns None if not implemented for T. If the array is empty, 0 is returned
source§

fn min(&self) -> Option<T::Native>

source§

fn max(&self) -> Option<T::Native>

Returns the maximum value in the array, according to the natural order. Returns None if the array is empty or only contains null values.
source§

fn min_max(&self) -> Option<(T::Native, T::Native)>

source§

fn mean(&self) -> Option<f64>

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

impl<T> ChunkAggSeries for ChunkedArray<T>
where T: PolarsNumericType, PrimitiveArray<T::Native>: for<'a> MinMaxKernel<Scalar<'a> = T::Native>, <T::Native as Simd>::Simd: Add<Output = <T::Native as Simd>::Simd> + Sum<T::Native>, ChunkedArray<T>: IntoSeries,

source§

fn sum_reduce(&self) -> Scalar

Get the sum of the ChunkedArray as a new Series of length 1.
source§

fn max_reduce(&self) -> Scalar

Get the max of the ChunkedArray as a new Series of length 1.
source§

fn min_reduce(&self) -> Scalar

Get the min of the ChunkedArray as a new Series of length 1.
source§

fn prod_reduce(&self) -> Scalar

Get the product of the ChunkedArray as a new Series of length 1.
source§

impl<T> ChunkAnyValue for ChunkedArray<T>

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, T> ChunkApply<'a, <T as PolarsNumericType>::Native> for ChunkedArray<T>

§

type FuncRet = <T as PolarsNumericType>::Native

source§

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

Apply a closure elementwise. This is fastest when the null check branching is more expensive than the closure application. Often it is. Read more
source§

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

Apply a closure elementwise including null values.
source§

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

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

impl<T> ChunkApplyKernel<PrimitiveArray<<T as PolarsNumericType>::Native>> for ChunkedArray<T>

source§

fn apply_kernel( &self, f: &dyn Fn(&PrimitiveArray<T::Native>) -> ArrayRef ) -> Self

Apply kernel and return result as a new ChunkedArray.
source§

fn apply_kernel_cast<S>( &self, f: &dyn Fn(&PrimitiveArray<T::Native>) -> ArrayRef ) -> ChunkedArray<S>
where S: PolarsDataType,

Apply a kernel that outputs an array of different type.
source§

impl<T> ChunkCast for ChunkedArray<T>

source§

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

source§

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

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

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

source§

impl ChunkCompare<&ChunkedArray<BinaryType>> for BinaryChunked

§

type Item = ChunkedArray<BooleanType>

source§

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

Check for equality.
source§

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

Check for equality where None == None.
source§

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

Check for inequality.
source§

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

Check for inequality where None == None.
source§

fn lt(&self, rhs: &BinaryChunked) -> BooleanChunked

Less than comparison.
source§

fn lt_eq(&self, rhs: &BinaryChunked) -> BooleanChunked

Less than or equal comparison
source§

fn gt(&self, rhs: &Self) -> BooleanChunked

Greater than comparison.
source§

fn gt_eq(&self, rhs: &Self) -> BooleanChunked

Greater than or equal comparison.
source§

impl ChunkCompare<&ChunkedArray<BooleanType>> for BooleanChunked

§

type Item = ChunkedArray<BooleanType>

source§

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

Check for equality.
source§

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

Check for equality where None == None.
source§

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

Check for inequality.
source§

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

Check for inequality where None == None.
source§

fn lt(&self, rhs: &BooleanChunked) -> BooleanChunked

Less than comparison.
source§

fn lt_eq(&self, rhs: &BooleanChunked) -> BooleanChunked

Less than or equal comparison
source§

fn gt(&self, rhs: &Self) -> BooleanChunked

Greater than comparison.
source§

fn gt_eq(&self, rhs: &Self) -> BooleanChunked

Greater than or equal comparison.
source§

impl ChunkCompare<&ChunkedArray<ListType>> for ListChunked

§

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§

fn gt(&self, _rhs: &ListChunked) -> BooleanChunked

Greater than comparison.
source§

fn gt_eq(&self, _rhs: &ListChunked) -> BooleanChunked

Greater than or equal comparison.
source§

fn lt(&self, _rhs: &ListChunked) -> BooleanChunked

Less than comparison.
source§

fn lt_eq(&self, _rhs: &ListChunked) -> BooleanChunked

Less than or equal comparison
source§

impl ChunkCompare<&ChunkedArray<StringType>> for CategoricalChunked

Available on crate feature dtype-categorical only.
§

type Item = Result<ChunkedArray<BooleanType>, PolarsError>

source§

fn equal(&self, rhs: &StringChunked) -> Self::Item

Check for equality.
source§

fn equal_missing(&self, rhs: &StringChunked) -> Self::Item

Check for equality where None == None.
source§

fn not_equal(&self, rhs: &StringChunked) -> Self::Item

Check for inequality.
source§

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

Check for inequality where None == None.
source§

fn gt(&self, rhs: &StringChunked) -> Self::Item

Greater than comparison.
source§

fn gt_eq(&self, rhs: &StringChunked) -> Self::Item

Greater than or equal comparison.
source§

fn lt(&self, rhs: &StringChunked) -> Self::Item

Less than comparison.
source§

fn lt_eq(&self, rhs: &StringChunked) -> Self::Item

Less than or equal comparison
source§

impl ChunkCompare<&ChunkedArray<StringType>> for StringChunked

§

type Item = ChunkedArray<BooleanType>

source§

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

Check for equality.
source§

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

Check for equality where None == None.
source§

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

Check for inequality.
source§

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

Check for inequality where None == None.
source§

fn gt(&self, rhs: &StringChunked) -> BooleanChunked

Greater than comparison.
source§

fn gt_eq(&self, rhs: &StringChunked) -> BooleanChunked

Greater than or equal comparison.
source§

fn lt(&self, rhs: &StringChunked) -> BooleanChunked

Less than comparison.
source§

fn lt_eq(&self, rhs: &StringChunked) -> BooleanChunked

Less than or equal comparison
source§

impl<T> ChunkCompare<&ChunkedArray<T>> for ChunkedArray<T>
where T: PolarsNumericType, T::Array: TotalOrdKernel<Scalar = T::Native>,

§

type Item = ChunkedArray<BooleanType>

source§

fn equal(&self, rhs: &ChunkedArray<T>) -> BooleanChunked

Check for equality.
source§

fn equal_missing(&self, rhs: &ChunkedArray<T>) -> BooleanChunked

Check for equality where None == None.
source§

fn not_equal(&self, rhs: &ChunkedArray<T>) -> BooleanChunked

Check for inequality.
source§

fn not_equal_missing(&self, rhs: &ChunkedArray<T>) -> BooleanChunked

Check for inequality where None == None.
source§

fn lt(&self, rhs: &ChunkedArray<T>) -> BooleanChunked

Less than comparison.
source§

fn lt_eq(&self, rhs: &ChunkedArray<T>) -> BooleanChunked

Less than or equal comparison
source§

fn gt(&self, rhs: &Self) -> BooleanChunked

Greater than comparison.
source§

fn gt_eq(&self, rhs: &Self) -> BooleanChunked

Greater than or equal comparison.
source§

impl<T, Rhs> ChunkCompare<Rhs> for ChunkedArray<T>
where T: PolarsNumericType, Rhs: ToPrimitive, T::Array: TotalOrdKernel<Scalar = T::Native>,

§

type Item = ChunkedArray<BooleanType>

source§

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

Check for equality.
source§

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

Check for equality where None == None.
source§

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

Check for inequality.
source§

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

Check for inequality where None == None.
source§

fn gt(&self, rhs: Rhs) -> BooleanChunked

Greater than comparison.
source§

fn gt_eq(&self, rhs: Rhs) -> BooleanChunked

Greater than or equal comparison.
source§

fn lt(&self, rhs: Rhs) -> BooleanChunked

Less than comparison.
source§

fn lt_eq(&self, rhs: Rhs) -> BooleanChunked

Less than or equal comparison
source§

impl<T: PolarsNumericType> ChunkExpandAtIndex<T> for ChunkedArray<T>

source§

fn new_from_index(&self, index: usize, length: usize) -> ChunkedArray<T>

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

impl<T> ChunkFillNullValue<<T as PolarsNumericType>::Native> for ChunkedArray<T>

source§

fn fill_null_with_values(&self, value: T::Native) -> PolarsResult<Self>

Replace None values with a give value T.
source§

impl<T> ChunkFilter<T> for ChunkedArray<T>

source§

fn filter(&self, filter: &BooleanChunked) -> PolarsResult<ChunkedArray<T>>

Filter values in the ChunkedArray with a boolean mask. Read more
source§

impl<T> ChunkFull<<T as PolarsNumericType>::Native> for ChunkedArray<T>

source§

fn full(name: &str, value: T::Native, length: usize) -> Self

Create a ChunkedArray with a single value.
source§

impl<T> ChunkFullNull for ChunkedArray<T>

source§

fn full_null(name: &str, length: usize) -> Self

source§

impl<T> ChunkQuantile<f64> for ChunkedArray<T>

source§

fn quantile( &self, quantile: f64, interpol: QuantileInterpolOptions ) -> PolarsResult<Option<f64>>

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

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

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

impl<T> ChunkReverse for ChunkedArray<T>

source§

fn reverse(&self) -> ChunkedArray<T>

Return a reversed version of this array.
source§

impl<T> ChunkRollApply for ChunkedArray<T>
where T: PolarsNumericType, Self: IntoSeries,

Available on crate feature rolling_window only.
source§

fn rolling_map( &self, f: &dyn Fn(&Series) -> Series, options: RollingOptionsFixedWindow ) -> PolarsResult<Series>

Apply a rolling custom function. This is pretty slow because of dynamic dispatch.

source§

impl<'a, T> ChunkSet<'a, <T as PolarsNumericType>::Native, <T as PolarsNumericType>::Native> for ChunkedArray<T>

source§

fn scatter_single<I: IntoIterator<Item = IdxSize>>( &'a self, idx: I, value: Option<T::Native> ) -> PolarsResult<Self>

Set the values at indexes idx to some optional value Option<T>. Read more
source§

fn scatter_with<I: IntoIterator<Item = IdxSize>, F>( &'a self, idx: I, f: F ) -> PolarsResult<Self>
where F: Fn(Option<T::Native>) -> Option<T::Native>,

Set the values at indexes idx by applying a closure to these values. Read more
source§

fn set( &'a self, mask: &BooleanChunked, value: Option<T::Native> ) -> PolarsResult<Self>

Set the values where the mask evaluates to true to some optional value Option<T>. Read more
source§

impl<T> ChunkShift<T> for ChunkedArray<T>

source§

fn shift(&self, periods: i64) -> ChunkedArray<T>

source§

impl<T> ChunkShiftFill<T, Option<<T as PolarsNumericType>::Native>> for ChunkedArray<T>

source§

fn shift_and_fill( &self, periods: i64, fill_value: Option<T::Native> ) -> ChunkedArray<T>

Shift the values by a given period and fill the parts that will be empty due to this operation with fill_value.
source§

impl<T> ChunkSort<T> for ChunkedArray<T>

source§

fn arg_sort_multiple( &self, by: &[Series], options: &SortMultipleOptions ) -> PolarsResult<IdxCa>

§Panics

This function is very opinionated. We assume that all numeric Series are of the same type, if not it will panic

source§

fn sort_with(&self, options: SortOptions) -> ChunkedArray<T>

source§

fn sort(&self, descending: bool) -> ChunkedArray<T>

Returned a sorted ChunkedArray.
source§

fn arg_sort(&self, options: SortOptions) -> IdxCa

Retrieve the indexes needed to sort this array.
source§

impl<T: PolarsDataType> ChunkTake<ChunkedArray<UInt32Type>> for ChunkedArray<T>

source§

fn take(&self, indices: &IdxCa) -> PolarsResult<Self>

Gather values from ChunkedArray by index.

source§

impl<T: PolarsDataType, I: AsRef<[IdxSize]> + ?Sized> ChunkTake<I> for ChunkedArray<T>

source§

fn take(&self, indices: &I) -> PolarsResult<Self>

Gather values from ChunkedArray by index.

source§

impl ChunkTakeUnchecked<ChunkedArray<UInt32Type>> for BinaryChunked

source§

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

Gather values from ChunkedArray by index.

source§

impl ChunkTakeUnchecked<ChunkedArray<UInt32Type>> for StringChunked

source§

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

Gather values from ChunkedArray by index. Read more
source§

impl<T> ChunkTakeUnchecked<ChunkedArray<UInt32Type>> for ChunkedArray<T>
where T: PolarsDataType<HasViews = FalseT> + PolarsDataType,

source§

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

Gather values from ChunkedArray by index.

source§

impl<T, I: AsRef<[IdxSize]> + ?Sized> ChunkTakeUnchecked<I> for ChunkedArray<T>
where T: PolarsDataType<HasViews = FalseT> + PolarsDataType,

source§

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

Gather values from ChunkedArray by index.

source§

impl<T> ChunkUnique for ChunkedArray<T>

Available on crate feature algorithm_group_by only.
source§

fn unique(&self) -> PolarsResult<Self>

Get unique values of a ChunkedArray
source§

fn arg_unique(&self) -> PolarsResult<IdxCa>

Get first index of the unique values in a ChunkedArray. This Vec is sorted.
source§

fn n_unique(&self) -> PolarsResult<usize>

Number of unique values in the ChunkedArray
source§

impl<T> ChunkVar for ChunkedArray<T>

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<T> ChunkZip<T> for ChunkedArray<T>
where T: PolarsDataType, T::Array: for<'a> IfThenElseKernel<Scalar<'a> = T::Physical<'a>>, ChunkedArray<T>: ChunkExpandAtIndex<T>,

Available on crate feature zip_with only.
source§

fn zip_with( &self, mask: &BooleanChunked, other: &ChunkedArray<T> ) -> PolarsResult<ChunkedArray<T>>

Create a new ChunkedArray with values from self where the mask evaluates true and values from other where the mask evaluates false
source§

impl<T: PolarsDataType> Clone for ChunkedArray<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: PolarsDataType> Container for ChunkedArray<T>

source§

fn slice(&self, offset: i64, len: usize) -> Self

source§

fn len(&self) -> usize

source§

fn iter_chunks(&self) -> impl Iterator<Item = Self>

source§

fn n_chunks(&self) -> usize

source§

fn chunk_lengths(&self) -> impl Iterator<Item = usize>

source§

impl Debug for ChunkedArray<BooleanType>

source§

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

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

impl<T> Debug for ChunkedArray<T>

source§

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

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

impl<T: PolarsDataType> Default for ChunkedArray<T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T: PolarsNumericType, N: Num + ToPrimitive> Div<N> for &ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: N) -> Self::Output

Performs the / operation. Read more
source§

impl<T: PolarsNumericType, N: Num + ToPrimitive> Div<N> for ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: N) -> Self::Output

Performs the / operation. Read more
source§

impl<T: PolarsNumericType> Div for &ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl<T: PolarsNumericType> Div for ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl<T: PolarsDataType> Drop for ChunkedArray<T>

Available on crate feature object only.
source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a, T> From<&'a ChunkedArray<T>> for Vec<Option<T::Physical<'a>>>
where T: PolarsDataType,

source§

fn from(ca: &'a ChunkedArray<T>) -> Self

Converts to this type from the input type.
source§

impl<T, A> From<A> for ChunkedArray<T>
where T: PolarsDataType<Array = A>, A: Array,

source§

fn from(arr: A) -> Self

Converts to this type from the input type.
source§

impl From<ChunkedArray<BooleanType>> for Vec<Option<bool>>

source§

fn from(ca: BooleanChunked) -> Self

Converts to this type from the input type.
source§

impl From<ChunkedArray<StringType>> for Vec<Option<String>>

source§

fn from(ca: StringChunked) -> Self

Converts to this type from the input type.
source§

impl<T> From<ChunkedArray<T>> for Series

source§

fn from(ca: ChunkedArray<T>) -> Self

Converts to this type from the input type.
source§

impl<T> FromIterator<(Vec<<T as PolarsNumericType>::Native>, Option<Bitmap>)> for ChunkedArray<T>

source§

fn from_iter<I: IntoIterator<Item = (Vec<T::Native>, Option<Bitmap>)>>( iter: I ) -> Self

Creates a value from an iterator. Read more
source§

impl<T> FromIterator<Option<<T as PolarsNumericType>::Native>> for ChunkedArray<T>

FromIterator trait

source§

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

Creates a value from an iterator. Read more
source§

impl FromIterator<Option<bool>> for ChunkedArray<BooleanType>

source§

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

Creates a value from an iterator. Read more
source§

impl<T> FromIteratorReversed<Option<<T as PolarsNumericType>::Native>> for ChunkedArray<T>

source§

fn from_trusted_len_iter_rev<I: TrustedLen<Item = Option<T::Native>>>( iter: I ) -> Self

source§

impl<T> FromParallelIterator<Option<<T as PolarsNumericType>::Native>> for ChunkedArray<T>

source§

fn from_par_iter<I: IntoParallelIterator<Item = Option<T::Native>>>( iter: I ) -> Self

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

impl<T> FromTrustedLenIterator<Option<<T as PolarsNumericType>::Native>> for ChunkedArray<T>

source§

fn from_iter_trusted_length<I: IntoIterator<Item = Option<T::Native>>>( iter: I ) -> Self
where I::IntoIter: TrustedLen,

source§

impl FromTrustedLenIterator<Option<bool>> for ChunkedArray<BooleanType>

source§

fn from_iter_trusted_length<I: IntoIterator<Item = Option<bool>>>( iter: I ) -> Self
where I::IntoIter: TrustedLen,

source§

impl<T> IntoGroupsProxy for ChunkedArray<T>

Available on crate feature algorithm_group_by only.
source§

fn group_tuples( &self, multithreaded: bool, sorted: bool ) -> PolarsResult<GroupsProxy>

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, T> IntoIterator for &'a ChunkedArray<T>

§

type Item = Option<<T as PolarsNumericType>::Native>

The type of the elements being iterated over.
§

type IntoIter = Box<dyn PolarsIterator<Item = <&'a ChunkedArray<T> 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<T: PolarsDataType + 'static> IntoSeries for ChunkedArray<T>
where SeriesWrap<ChunkedArray<T>>: SeriesTrait,

source§

fn into_series(self) -> Series
where Self: Sized,

source§

fn is_series() -> bool

source§

impl<T> MetadataCollectable<T> for ChunkedArray<T>

source§

impl<T: PolarsNumericType, N: Num + ToPrimitive> Mul<N> for &ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: N) -> Self::Output

Performs the * operation. Read more
source§

impl<T: PolarsNumericType, N: Num + ToPrimitive> Mul<N> for ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: N) -> Self::Output

Performs the * operation. Read more
source§

impl<T: PolarsNumericType> Mul for &ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl<T: PolarsNumericType> Mul for ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl NamedFrom<Range<i32>, Int32Type> for ChunkedArray<Int32Type>

source§

fn new(name: &str, range: Range<i32>) -> Self

Initialize by name and values.
source§

impl NamedFrom<Range<i64>, Int64Type> for ChunkedArray<Int64Type>

source§

fn new(name: &str, range: Range<i64>) -> Self

Initialize by name and values.
source§

impl NamedFrom<Range<u32>, UInt32Type> for ChunkedArray<UInt32Type>

source§

fn new(name: &str, range: Range<u32>) -> Self

Initialize by name and values.
source§

impl NamedFrom<Range<u64>, UInt64Type> for ChunkedArray<UInt64Type>

source§

fn new(name: &str, range: Range<u64>) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[Option<String>]>> NamedFrom<T, [Option<String>]> for ChunkedArray<StringType>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[Option<Vec<u8>>]>> NamedFrom<T, [Option<Vec<u8>>]> for ChunkedArray<BinaryType>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[Option<bool>]>> NamedFrom<T, [Option<bool>]> for ChunkedArray<BooleanType>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[Option<f32>]>> NamedFrom<T, [Option<f32>]> for ChunkedArray<Float32Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[Option<f64>]>> NamedFrom<T, [Option<f64>]> for ChunkedArray<Float64Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[Option<i32>]>> NamedFrom<T, [Option<i32>]> for ChunkedArray<Int32Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[Option<i64>]>> NamedFrom<T, [Option<i64>]> for ChunkedArray<Int64Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[Option<u32>]>> NamedFrom<T, [Option<u32>]> for ChunkedArray<UInt32Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[Option<u64>]>> NamedFrom<T, [Option<u64>]> for ChunkedArray<UInt64Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[String]>> NamedFrom<T, [String]> for ChunkedArray<StringType>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[Vec<u8>]>> NamedFrom<T, [Vec<u8>]> for ChunkedArray<BinaryType>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[bool]>> NamedFrom<T, [bool]> for ChunkedArray<BooleanType>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[f32]>> NamedFrom<T, [f32]> for ChunkedArray<Float32Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[f64]>> NamedFrom<T, [f64]> for ChunkedArray<Float64Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[i32]>> NamedFrom<T, [i32]> for ChunkedArray<Int32Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[i64]>> NamedFrom<T, [i64]> for ChunkedArray<Int64Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[u32]>> NamedFrom<T, [u32]> for ChunkedArray<UInt32Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T: AsRef<[u64]>> NamedFrom<T, [u64]> for ChunkedArray<UInt64Type>

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<T> NewChunkedArray<T, <T as PolarsNumericType>::Native> for ChunkedArray<T>

source§

fn from_iter_values( name: &str, it: impl Iterator<Item = T::Native> ) -> ChunkedArray<T>

Create a new ChunkedArray from an iterator.

source§

fn from_slice(name: &str, v: &[T::Native]) -> Self

source§

fn from_slice_options(name: &str, opt_v: &[Option<T::Native>]) -> Self

source§

fn from_iter_options( name: &str, it: impl Iterator<Item = Option<T::Native>> ) -> ChunkedArray<T>

Create a new ChunkedArray from an iterator.
source§

impl<T: NumOpsDispatchInner> NumOpsDispatch for ChunkedArray<T>

source§

impl<S: NumOpsDispatchCheckedInner> NumOpsDispatchChecked for ChunkedArray<S>

Available on crate feature checked_arithmetic only.
source§

fn checked_div(&self, rhs: &Series) -> PolarsResult<Series>

Checked integer division. Computes self / rhs, returning None if rhs == 0 or the division results in overflow.
source§

fn checked_div_num<T: ToPrimitive>(&self, rhs: T) -> PolarsResult<Series>

source§

impl<T> QuantileAggSeries for ChunkedArray<T>
where T: PolarsIntegerType, T::Native: Ord, <T::Native as Simd>::Simd: Add<Output = <T::Native as Simd>::Simd> + Sum<T::Native>,

source§

fn quantile_reduce( &self, quantile: f64, interpol: QuantileInterpolOptions ) -> PolarsResult<Scalar>

Get the quantile of the ChunkedArray as a new Series of length 1.
source§

fn median_reduce(&self) -> Scalar

Get the median of the ChunkedArray as a new Series of length 1.
source§

impl<T: PolarsNumericType, N: Num + ToPrimitive> Rem<N> for &ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: N) -> Self::Output

Performs the % operation. Read more
source§

impl<T: PolarsNumericType, N: Num + ToPrimitive> Rem<N> for ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: N) -> Self::Output

Performs the % operation. Read more
source§

impl<T: PolarsNumericType> Rem for &ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
source§

impl<T: PolarsNumericType> Rem for ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
source§

impl<T: PolarsNumericType, N: Num + ToPrimitive> Sub<N> for &ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: N) -> Self::Output

Performs the - operation. Read more
source§

impl<T: PolarsNumericType, N: Num + ToPrimitive> Sub<N> for ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: N) -> Self::Output

Performs the - operation. Read more
source§

impl<T: PolarsNumericType> Sub for &ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl<T: PolarsNumericType> Sub for ChunkedArray<T>

§

type Output = ChunkedArray<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl<T> VarAggSeries for ChunkedArray<T>

source§

fn var_reduce(&self, ddof: u8) -> Scalar

Get the variance of the ChunkedArray as a new Series of length 1.
source§

fn std_reduce(&self, ddof: u8) -> Scalar

Get the standard deviation of the ChunkedArray as a new Series of length 1.

Auto Trait Implementations§

§

impl<T> Freeze for ChunkedArray<T>

§

impl<T> !RefUnwindSafe for ChunkedArray<T>

§

impl<T> Send for ChunkedArray<T>

§

impl<T> Sync for ChunkedArray<T>

§

impl<T> Unpin for ChunkedArray<T>

§

impl<T> !UnwindSafe for ChunkedArray<T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<A, T, E> FromFallibleIterator<A, E> for T
where T: FromIterator<A>, E: Error,

source§

fn from_fallible_iter<F>(iter: F) -> Result<T, E>
where F: FallibleIterator<E, Item = A>,

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,