Struct polars::prelude::Logical

source ·
pub struct Logical<Logical, Physical>(pub ChunkedArray<Physical>, _, pub Option<DataType>)
where
    Logical: PolarsDataType,
    Physical: PolarsDataType;
Expand description

Maps a logical type to a chunked array implementation of the physical type. This saves a lot of compiler bloat and allows us to reuse functionality.

Tuple Fields§

§0: ChunkedArray<Physical>§2: Option<DataType>

Implementations§

source§

impl Logical<DecimalType, Int128Type>

source

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

source

pub fn scale(&self) -> usize

source§

impl<K, T> Logical<K, T>

source

pub fn new_logical<J>(ca: ChunkedArray<T>) -> Logical<J, T>
where J: PolarsDataType,

source§

impl<K, T> Logical<K, T>

source

pub fn field(&self) -> Field

source§

impl Logical<DateType, Int32Type>

source

pub fn as_date_iter(&self) -> impl TrustedLen

source

pub fn from_naive_date<I>(name: &str, v: I) -> Logical<DateType, Int32Type>
where I: IntoIterator<Item = NaiveDate>,

Construct a new DateChunked from an iterator over NaiveDate.

source

pub fn to_string(&self, format: &str) -> ChunkedArray<StringType>

Convert from Date into String with the given format. See chrono strftime/strptime.

source

pub fn strftime(&self, format: &str) -> ChunkedArray<StringType>

Convert from Date into String with the given format. See chrono strftime/strptime.

Alias for to_string.

source

pub fn from_naive_date_options<I>( name: &str, v: I ) -> Logical<DateType, Int32Type>
where I: IntoIterator<Item = Option<NaiveDate>>,

Construct a new DateChunked from an iterator over optional NaiveDate.

source§

impl Logical<DatetimeType, Int64Type>

source

pub fn as_datetime_iter(&self) -> impl TrustedLen

source

pub fn time_unit(&self) -> TimeUnit

source

pub fn time_zone(&self) -> &Option<String>

source

pub fn to_string( &self, format: &str ) -> Result<ChunkedArray<StringType>, PolarsError>

Convert from Datetime into String with the given format. See chrono strftime/strptime.

source

pub fn strftime( &self, format: &str ) -> Result<ChunkedArray<StringType>, PolarsError>

Convert from Datetime into String with the given format. See chrono strftime/strptime.

Alias for to_string.

source

pub fn from_naive_datetime<I>( name: &str, v: I, tu: TimeUnit ) -> Logical<DatetimeType, Int64Type>
where I: IntoIterator<Item = NaiveDateTime>,

Construct a new DatetimeChunked from an iterator over NaiveDateTime.

source

pub fn from_naive_datetime_options<I>( name: &str, v: I, tu: TimeUnit ) -> Logical<DatetimeType, Int64Type>
where I: IntoIterator<Item = Option<NaiveDateTime>>,

source

pub fn cast_time_unit(&self, tu: TimeUnit) -> Logical<DatetimeType, Int64Type>

Change the underlying TimeUnit. And update the data accordingly.

source

pub fn set_time_unit(&mut self, tu: TimeUnit)

Change the underlying TimeUnit. This does not modify the data.

source

pub fn set_time_zone(&mut self, time_zone: String) -> Result<(), PolarsError>

Available on crate feature timezones only.

Change the underlying TimeZone. This does not modify the data.

source§

impl Logical<DurationType, Int64Type>

source

pub fn time_unit(&self) -> TimeUnit

source

pub fn cast_time_unit(&self, tu: TimeUnit) -> Logical<DurationType, Int64Type>

Change the underlying TimeUnit. And update the data accordingly.

source

pub fn set_time_unit(&mut self, tu: TimeUnit)

Change the underlying TimeUnit. This does not modify the data.

source

pub fn from_duration<I>( name: &str, v: I, tu: TimeUnit ) -> Logical<DurationType, Int64Type>
where I: IntoIterator<Item = TimeDelta>,

Construct a new DurationChunked from an iterator over ChronoDuration.

source

pub fn from_duration_options<I>( name: &str, v: I, tu: TimeUnit ) -> Logical<DurationType, Int64Type>
where I: IntoIterator<Item = Option<TimeDelta>>,

Construct a new DurationChunked from an iterator over optional ChronoDuration.

source§

impl Logical<TimeType, Int64Type>

source

pub fn to_string(&self, format: &str) -> ChunkedArray<StringType>

Convert from Time into String with the given format. See chrono strftime/strptime.

source

pub fn strftime(&self, format: &str) -> ChunkedArray<StringType>

Convert from Time into String with the given format. See chrono strftime/strptime.

Alias for to_string.

source

pub fn as_time_iter(&self) -> impl TrustedLen

source

pub fn from_naive_time<I>(name: &str, v: I) -> Logical<TimeType, Int64Type>
where I: IntoIterator<Item = NaiveTime>,

Construct a new TimeChunked from an iterator over NaiveTime.

source

pub fn from_naive_time_options<I>( name: &str, v: I ) -> Logical<TimeType, Int64Type>
where I: IntoIterator<Item = Option<NaiveTime>>,

Construct a new TimeChunked from an iterator over optional NaiveTime.

Methods from Deref<Target = ChunkedArray<T>>§

source

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

source

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

source

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

source

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

source

pub fn append(&mut self, other: &ChunkedArray<T>)

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

pub fn apply_values_generic<'a, U, K, F>(&'a self, op: F) -> ChunkedArray<U>
where U: PolarsDataType, F: FnMut(<T as PolarsDataType>::Physical<'a>) -> K, <U as PolarsDataType>::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>

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>

source

pub fn try_apply_generic<'a, U, K, F, E>( &'a self, op: F ) -> Result<ChunkedArray<U>, E>

source

pub fn cast_and_apply_in_place<F, S>(&self, f: F) -> ChunkedArray<S>

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

source

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

source

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

source

pub fn apply_to_buffer<'a, F>(&'a self, f: F) -> ChunkedArray<StringType>
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

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

source

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

source

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

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: u32)

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) -> ChunkedArray<T>

source

pub fn slice(&self, offset: i64, length: usize) -> ChunkedArray<T>

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) -> ChunkedArray<T>
where ChunkedArray<T>: Sized,

Take a view of top n elements

source

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

Get the head of the ChunkedArray

source

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

Get the tail of the ChunkedArray

source

pub fn prune_empty_chunks(&mut self)

Remove empty chunks.

source

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

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

pub fn extend(&mut self, other: &ChunkedArray<T>)

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

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

source

pub fn is_null(&self) -> ChunkedArray<BooleanType>

Get a mask of the null values.

source

pub fn is_not_null(&self) -> ChunkedArray<BooleanType>

Get a mask of the valid values.

source

pub fn rolling_map_float<F>( &self, window_size: usize, f: F ) -> Result<ChunkedArray<T>, PolarsError>
where F: FnMut(&mut ChunkedArray<T>) -> Option<<T as PolarsNumericType>::Native>,

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

source

pub unsafe fn to_string_unchecked(&self) -> ChunkedArray<StringType>

§Safety

String is not validated

source

pub fn as_binary(&self) -> ChunkedArray<BinaryType>

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

pub fn is_nan(&self) -> ChunkedArray<BooleanType>

source

pub fn is_not_nan(&self) -> ChunkedArray<BooleanType>

source

pub fn is_finite(&self) -> ChunkedArray<BooleanType>

source

pub fn is_infinite(&self) -> ChunkedArray<BooleanType>

source

pub fn none_to_nan(&self) -> ChunkedArray<T>

Convert missing values to NaN values.

source

pub fn to_canonical(&self) -> ChunkedArray<T>

source

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

source

pub fn par_iter_indexed(&mut self) -> impl IndexedParallelIterator

source

pub fn par_iter_indexed(&self) -> impl IndexedParallelIterator

source

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

source

pub fn iter(&self) -> impl PolarsIterator

source

pub fn to_ndarray( &self ) -> Result<ArrayBase<ViewRepr<&<T as PolarsNumericType>::Native>, Dim<[usize; 1]>>, PolarsError>

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

source

pub fn to_ndarray<N>( &self ) -> Result<ArrayBase<OwnedRepr<<N as PolarsNumericType>::Native>, Dim<[usize; 2]>>, PolarsError>

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

source

pub fn amortized_iter( &self ) -> AmortizedListIter<'_, impl Iterator<Item = Option<Box<dyn Array>>>>

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: &str ) -> AmortizedListIter<'_, impl Iterator<Item = Option<Box<dyn Array>>>>

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 ) -> Result<ChunkedArray<ListType>, PolarsError>

source

pub unsafe fn apply_amortized_same_type<F>( &self, f: F ) -> ChunkedArray<FixedSizeListType>
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 ) -> Result<ChunkedArray<FixedSizeListType>, PolarsError>

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 ) -> ChunkedArray<FixedSizeListType>

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 ) -> Result<ChunkedArray<V>, PolarsError>

Try apply a closure F elementwise.

source

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

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

Get the inner values as Series

source

pub fn apply_to_inner( &self, func: &dyn Fn(Series) -> Result<Series, PolarsError> ) -> Result<ChunkedArray<FixedSizeListType>, PolarsError>

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

source

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

source

pub unsafe fn with_chunks(&self, chunks: Vec<Box<dyn Array>>) -> ChunkedArray<T>

§Safety

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

source

pub fn amortized_iter( &self ) -> AmortizedListIter<'_, impl Iterator<Item = Option<Box<dyn Array>>>>

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<Box<dyn Array>>>>

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 ) -> Result<ChunkedArray<V>, PolarsError>

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 ) -> ChunkedArray<ListType>
where T: PolarsDataType, &'a ChunkedArray<T>: IntoIterator<IntoIter = I>, I: TrustedLen<Item = Option<<T as PolarsDataType>::Physical<'a>>>, F: FnMut(Option<AmortSeries>, Option<<T as PolarsDataType>::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 ) -> ChunkedArray<ListType>

source

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

source

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

Apply a closure F elementwise.

source

pub fn try_apply_amortized<F>( &self, f: F ) -> Result<ChunkedArray<ListType>, PolarsError>

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) -> Result<Series, PolarsError> ) -> Result<ChunkedArray<ListType>, PolarsError>

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

source

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

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 + 'static)>

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

source

pub fn sample_n( &self, n: usize, with_replacement: bool, shuffle: bool, seed: Option<u64> ) -> Result<ChunkedArray<T>, PolarsError>

Sample n datapoints from this ChunkedArray.

source

pub fn sample_frac( &self, frac: f64, with_replacement: bool, shuffle: bool, seed: Option<u64> ) -> Result<ChunkedArray<T>, PolarsError>

Sample a fraction between 0.0-1.0 of this ChunkedArray.

source

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

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

source

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

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

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) -> ChunkedArray<T>

Set the ‘sorted’ bit meta info.

source

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

source

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

source

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

source

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

source

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

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: &ChunkedArray<T>, 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) -> ChunkedArray<T>

source

pub fn iter_validities( &self ) -> Map<Iter<'_, Box<dyn Array>>, fn(_: &Box<dyn Array>) -> 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) -> ChunkedArray<T>

source

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

Series to ChunkedArray<T>

source

pub fn chunk_lengths( &self ) -> Map<Iter<'_, Box<dyn Array>>, fn(_: &Box<dyn Array>) -> usize>

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

source

pub fn chunks(&self) -> &Vec<Box<dyn Array>>

A reference to the chunks

source

pub unsafe fn chunks_mut(&mut self) -> &mut Vec<Box<dyn Array>>

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 get(&self, idx: usize) -> Option<<T as PolarsDataType>::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 as PolarsDataType>::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 as PolarsDataType>::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 as PolarsDataType>::Physical<'_>>

source

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

source

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

Available on crate feature dtype-array only.
source

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

source

pub fn cont_slice( &self ) -> Result<&[<T as PolarsNumericType>::Native], PolarsError>

Returns the values of the array as a contiguous slice.

source

pub fn data_views(&self) -> impl DoubleEndedIterator

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 + DoubleEndedIterator + TrustedLen

source

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

source

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

Apply lhs - self

source

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

Apply lhs / self

source

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

Apply lhs % self

Trait Implementations§

source§

impl Add for &Logical<DecimalType, Int128Type>

§

type Output = Result<Logical<DecimalType, Int128Type>, PolarsError>

The resulting type after applying the + operator.
source§

fn add( self, rhs: &Logical<DecimalType, Int128Type> ) -> <&Logical<DecimalType, Int128Type> as Add>::Output

Performs the + operation. Read more
source§

impl<K, T> Clone for Logical<K, T>

source§

fn clone(&self) -> Logical<K, T>

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 DateMethods for Logical<DateType, Int32Type>

source§

fn parse_from_str_slice( name: &str, v: &[&str], fmt: &str ) -> Logical<DateType, Int32Type>

source§

fn year(&self) -> ChunkedArray<Int32Type>

Extract month from underlying NaiveDate representation. Returns the year number in the calendar date.
source§

fn is_leap_year(&self) -> ChunkedArray<BooleanType>

Extract year from underlying NaiveDate representation. Returns whether the year is a leap year.
source§

fn iso_year(&self) -> ChunkedArray<Int32Type>

This year number might not match the calendar year number.
source§

fn quarter(&self) -> ChunkedArray<Int8Type>

Extract month from underlying NaiveDateTime representation. Quarters range from 1 to 4.
source§

fn month(&self) -> ChunkedArray<Int8Type>

Extract month from underlying NaiveDateTime representation. Returns the month number starting from 1. Read more
source§

fn weekday(&self) -> ChunkedArray<Int8Type>

Extract ISO weekday from underlying NaiveDate representation. Returns the weekday number where monday = 1 and sunday = 7
source§

fn week(&self) -> ChunkedArray<Int8Type>

Returns the ISO week number starting from 1. The return value ranges from 1 to 53. (The last week of year differs by years.)
source§

fn day(&self) -> ChunkedArray<Int8Type>

Extract day from underlying NaiveDate representation. Returns the day of month starting from 1. Read more
source§

fn ordinal(&self) -> ChunkedArray<Int16Type>

Returns the day of year starting from 1. Read more
source§

impl DatetimeMethods for Logical<DatetimeType, Int64Type>

source§

fn year(&self) -> ChunkedArray<Int32Type>

Extract month from underlying NaiveDateTime representation. Returns the year number in the calendar date.
source§

fn is_leap_year(&self) -> ChunkedArray<BooleanType>

Extract year from underlying NaiveDate representation. Returns whether the year is a leap year.
source§

fn iso_year(&self) -> ChunkedArray<Int32Type>

source§

fn quarter(&self) -> ChunkedArray<Int8Type>

Extract quarter from underlying NaiveDateTime representation. Quarters range from 1 to 4.
source§

fn month(&self) -> ChunkedArray<Int8Type>

Extract month from underlying NaiveDateTime representation. Returns the month number starting from 1. Read more
source§

fn weekday(&self) -> ChunkedArray<Int8Type>

Extract ISO weekday from underlying NaiveDateTime representation. Returns the weekday number where monday = 1 and sunday = 7
source§

fn week(&self) -> ChunkedArray<Int8Type>

Returns the ISO week number starting from 1. The return value ranges from 1 to 53. (The last week of year differs by years.)
source§

fn day(&self) -> ChunkedArray<Int8Type>

Extract day from underlying NaiveDateTime representation. Returns the day of month starting from 1. Read more
source§

fn hour(&self) -> ChunkedArray<Int8Type>

Extract hour from underlying NaiveDateTime representation. Returns the hour number from 0 to 23.
source§

fn minute(&self) -> ChunkedArray<Int8Type>

Extract minute from underlying NaiveDateTime representation. Returns the minute number from 0 to 59.
source§

fn second(&self) -> ChunkedArray<Int8Type>

Extract second from underlying NaiveDateTime representation. Returns the second number from 0 to 59.
source§

fn nanosecond(&self) -> ChunkedArray<Int32Type>

Extract second from underlying NaiveDateTime representation. Returns the number of nanoseconds since the whole non-leap second. The range from 1,000,000,000 to 1,999,999,999 represents the leap second.
source§

fn ordinal(&self) -> ChunkedArray<Int16Type>

Returns the day of year starting from 1. Read more
source§

fn parse_from_str_slice( name: &str, v: &[&str], fmt: &str, tu: TimeUnit ) -> Logical<DatetimeType, Int64Type>

source§

impl<K, T> Deref for Logical<K, T>

§

type Target = ChunkedArray<T>

The resulting type after dereferencing.
source§

fn deref(&self) -> &<Logical<K, T> as Deref>::Target

Dereferences the value.
source§

impl<K, T> DerefMut for Logical<K, T>

source§

fn deref_mut(&mut self) -> &mut <Logical<K, T> as Deref>::Target

Mutably dereferences the value.
source§

impl Div for &Logical<DecimalType, Int128Type>

§

type Output = Result<Logical<DecimalType, Int128Type>, PolarsError>

The resulting type after applying the / operator.
source§

fn div( self, rhs: &Logical<DecimalType, Int128Type> ) -> <&Logical<DecimalType, Int128Type> as Div>::Output

Performs the / operation. Read more
source§

impl DurationMethods for Logical<DurationType, Int64Type>

source§

fn hours(&self) -> ChunkedArray<Int64Type>

Extract the hours from a Duration

source§

fn days(&self) -> ChunkedArray<Int64Type>

Extract the days from a Duration

source§

fn minutes(&self) -> ChunkedArray<Int64Type>

Extract the seconds from a Duration

source§

fn seconds(&self) -> ChunkedArray<Int64Type>

Extract the seconds from a Duration

source§

fn milliseconds(&self) -> ChunkedArray<Int64Type>

Extract the milliseconds from a Duration

source§

fn microseconds(&self) -> ChunkedArray<Int64Type>

Extract the microseconds from a Duration

source§

fn nanoseconds(&self) -> ChunkedArray<Int64Type>

Extract the nanoseconds from a Duration

source§

impl From<ChunkedArray<Int32Type>> for Logical<DateType, Int32Type>

source§

fn from(ca: ChunkedArray<Int32Type>) -> Logical<DateType, Int32Type>

Converts to this type from the input type.
source§

impl From<ChunkedArray<Int64Type>> for Logical<TimeType, Int64Type>

source§

fn from(ca: ChunkedArray<Int64Type>) -> Logical<TimeType, Int64Type>

Converts to this type from the input type.
source§

impl From<Logical<DateType, Int32Type>> for Series

Available on crate feature dtype-date only.
source§

fn from(a: Logical<DateType, Int32Type>) -> Series

Converts to this type from the input type.
source§

impl From<Logical<DatetimeType, Int64Type>> for Series

Available on crate feature dtype-datetime only.
source§

fn from(a: Logical<DatetimeType, Int64Type>) -> Series

Converts to this type from the input type.
source§

impl From<Logical<DurationType, Int64Type>> for Series

Available on crate feature dtype-duration only.
source§

fn from(a: Logical<DurationType, Int64Type>) -> Series

Converts to this type from the input type.
source§

impl From<Logical<TimeType, Int64Type>> for Series

Available on crate feature dtype-time only.
source§

fn from(a: Logical<TimeType, Int64Type>) -> Series

Converts to this type from the input type.
source§

impl IntoSeries for Logical<DateType, Int32Type>

source§

impl IntoSeries for Logical<DatetimeType, Int64Type>

source§

impl IntoSeries for Logical<DecimalType, Int128Type>

source§

impl IntoSeries for Logical<DurationType, Int64Type>

source§

impl IntoSeries for Logical<TimeType, Int64Type>

source§

impl LogicalType for Logical<DateType, Int32Type>

source§

fn dtype(&self) -> &DataType

Get data type of ChunkedArray.
source§

fn get_any_value(&self, i: usize) -> Result<AnyValue<'_>, PolarsError>

source§

unsafe fn get_any_value_unchecked(&self, i: usize) -> AnyValue<'_>

Safety Read more
source§

fn cast_with_options( &self, dtype: &DataType, cast_options: CastOptions ) -> Result<Series, PolarsError>

source§

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

source§

impl LogicalType for Logical<DatetimeType, Int64Type>

source§

fn dtype(&self) -> &DataType

Get data type of ChunkedArray.
source§

fn get_any_value(&self, i: usize) -> Result<AnyValue<'_>, PolarsError>

source§

unsafe fn get_any_value_unchecked(&self, i: usize) -> AnyValue<'_>

Safety Read more
source§

fn cast_with_options( &self, dtype: &DataType, cast_options: CastOptions ) -> Result<Series, PolarsError>

source§

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

source§

impl LogicalType for Logical<DecimalType, Int128Type>

source§

fn dtype(&self) -> &DataType

Get data type of ChunkedArray.
source§

fn get_any_value(&self, i: usize) -> Result<AnyValue<'_>, PolarsError>

source§

unsafe fn get_any_value_unchecked(&self, i: usize) -> AnyValue<'_>

Safety Read more
source§

fn cast_with_options( &self, dtype: &DataType, cast_options: CastOptions ) -> Result<Series, PolarsError>

source§

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

source§

impl LogicalType for Logical<DurationType, Int64Type>

source§

fn dtype(&self) -> &DataType

Get data type of ChunkedArray.
source§

fn get_any_value(&self, i: usize) -> Result<AnyValue<'_>, PolarsError>

source§

unsafe fn get_any_value_unchecked(&self, i: usize) -> AnyValue<'_>

Safety Read more
source§

fn cast_with_options( &self, dtype: &DataType, cast_options: CastOptions ) -> Result<Series, PolarsError>

source§

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

source§

impl LogicalType for Logical<TimeType, Int64Type>

source§

fn dtype(&self) -> &'static DataType

Get data type of ChunkedArray.
source§

fn get_any_value(&self, i: usize) -> Result<AnyValue<'_>, PolarsError>

source§

unsafe fn get_any_value_unchecked(&self, i: usize) -> AnyValue<'_>

Safety Read more
source§

fn cast_with_options( &self, dtype: &DataType, cast_options: CastOptions ) -> Result<Series, PolarsError>

source§

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

source§

impl Mul for &Logical<DecimalType, Int128Type>

§

type Output = Result<Logical<DecimalType, Int128Type>, PolarsError>

The resulting type after applying the * operator.
source§

fn mul( self, rhs: &Logical<DecimalType, Int128Type> ) -> <&Logical<DecimalType, Int128Type> as Mul>::Output

Performs the * operation. Read more
source§

impl<T> NamedFrom<T, [NaiveDate]> for Logical<DateType, Int32Type>
where T: AsRef<[NaiveDate]>,

Available on crate feature dtype-date only.
source§

fn new(name: &str, v: T) -> Logical<DateType, Int32Type>

Initialize by name and values.
source§

impl<T> NamedFrom<T, [NaiveDateTime]> for Logical<DatetimeType, Int64Type>
where T: AsRef<[NaiveDateTime]>,

Available on crate feature dtype-datetime only.
source§

fn new(name: &str, v: T) -> Logical<DatetimeType, Int64Type>

Initialize by name and values.
source§

impl<T> NamedFrom<T, [NaiveTime]> for Logical<TimeType, Int64Type>
where T: AsRef<[NaiveTime]>,

Available on crate feature dtype-time only.
source§

fn new(name: &str, v: T) -> Logical<TimeType, Int64Type>

Initialize by name and values.
source§

impl<T> NamedFrom<T, [Option<NaiveDate>]> for Logical<DateType, Int32Type>
where T: AsRef<[Option<NaiveDate>]>,

Available on crate feature dtype-date only.
source§

fn new(name: &str, v: T) -> Logical<DateType, Int32Type>

Initialize by name and values.
source§

impl<T> NamedFrom<T, [Option<NaiveDateTime>]> for Logical<DatetimeType, Int64Type>
where T: AsRef<[Option<NaiveDateTime>]>,

Available on crate feature dtype-datetime only.
source§

fn new(name: &str, v: T) -> Logical<DatetimeType, Int64Type>

Initialize by name and values.
source§

impl<T> NamedFrom<T, [Option<NaiveTime>]> for Logical<TimeType, Int64Type>
where T: AsRef<[Option<NaiveTime>]>,

Available on crate feature dtype-time only.
source§

fn new(name: &str, v: T) -> Logical<TimeType, Int64Type>

Initialize by name and values.
source§

impl<T> NamedFrom<T, [Option<TimeDelta>]> for Logical<DurationType, Int64Type>
where T: AsRef<[Option<TimeDelta>]>,

Available on crate feature dtype-duration only.
source§

fn new(name: &str, v: T) -> Logical<DurationType, Int64Type>

Initialize by name and values.
source§

impl<T> NamedFrom<T, [TimeDelta]> for Logical<DurationType, Int64Type>
where T: AsRef<[TimeDelta]>,

Available on crate feature dtype-duration only.
source§

fn new(name: &str, v: T) -> Logical<DurationType, Int64Type>

Initialize by name and values.
source§

impl PolarsRound for Logical<DateType, Int32Type>

source§

impl PolarsRound for Logical<DatetimeType, Int64Type>

source§

impl PolarsTruncate for Logical<DateType, Int32Type>

source§

impl PolarsTruncate for Logical<DatetimeType, Int64Type>

source§

impl Sub for &Logical<DecimalType, Int128Type>

§

type Output = Result<Logical<DecimalType, Int128Type>, PolarsError>

The resulting type after applying the - operator.
source§

fn sub( self, rhs: &Logical<DecimalType, Int128Type> ) -> <&Logical<DecimalType, Int128Type> as Sub>::Output

Performs the - operation. Read more
source§

impl TimeMethods for Logical<TimeType, Int64Type>

source§

fn hour(&self) -> ChunkedArray<Int8Type>

Extract hour from underlying NaiveDateTime representation. Returns the hour number from 0 to 23.

source§

fn minute(&self) -> ChunkedArray<Int8Type>

Extract minute from underlying NaiveDateTime representation. Returns the minute number from 0 to 59.

source§

fn second(&self) -> ChunkedArray<Int8Type>

Extract second from underlying NaiveDateTime representation. Returns the second number from 0 to 59.

source§

fn nanosecond(&self) -> ChunkedArray<Int32Type>

Extract second from underlying NaiveDateTime representation. Returns the number of nanoseconds since the whole non-leap second. The range from 1,000,000,000 to 1,999,999,999 represents the leap second.

source§

fn parse_from_str_slice( name: &str, v: &[&str], fmt: &str ) -> Logical<TimeType, Int64Type>

Auto Trait Implementations§

§

impl<Logical, Physical> Freeze for Logical<Logical, Physical>

§

impl<Logical, Physical> !RefUnwindSafe for Logical<Logical, Physical>

§

impl<Logical, Physical> Send for Logical<Logical, Physical>

§

impl<Logical, Physical> Sync for Logical<Logical, Physical>

§

impl<Logical, Physical> Unpin for Logical<Logical, Physical>
where Logical: Unpin,

§

impl<Logical, Physical> !UnwindSafe for Logical<Logical, Physical>

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