Logical

Struct Logical 

Source
pub struct Logical<Logical: PolarsDataType, Physical: PolarsDataType> {
    pub phys: ChunkedArray<Physical>,
    pub dtype: DataType,
    /* private fields */
}
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.

Fields§

§phys: ChunkedArray<Physical>§dtype: DataType

Implementations§

Source§

impl<T: PolarsCategoricalType> Logical<T, <T as PolarsCategoricalType>::PolarsPhysical>

Source

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

Available on crate feature dtype-categorical only.
Source

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

Available on crate feature dtype-categorical only.

Returned a sorted ChunkedArray.

Source

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

Available on crate feature dtype-categorical only.

Retrieve the indexes needed to sort this array.

Source§

impl<T: PolarsCategoricalType> Logical<T, <T as PolarsCategoricalType>::PolarsPhysical>

Source

pub fn is_enum(&self) -> bool

Available on crate feature dtype-categorical only.
Source

pub fn uses_lexical_ordering(&self) -> bool

Available on crate feature dtype-categorical only.

Return whether or not the CategoricalChunked uses the lexical order of the string values when sorting.

Source

pub fn full_null_with_dtype( name: PlSmallStr, length: usize, dtype: DataType, ) -> Self

Available on crate feature dtype-categorical only.
Source

pub fn from_cats_and_dtype( cat_ids: ChunkedArray<T::PolarsPhysical>, dtype: DataType, ) -> Self

Available on crate feature dtype-categorical only.

Create a CategoricalChunked from a physical array and dtype.

Checks that all the category ids are valid, mapping invalid ones to nulls.

Source

pub unsafe fn from_cats_and_dtype_unchecked( cat_ids: ChunkedArray<T::PolarsPhysical>, dtype: DataType, ) -> Self

Available on crate feature dtype-categorical only.

Create a CategoricalChunked from a physical array and dtype.

§Safety

It’s not checked that the indices are in-bounds or that the dtype is correct.

Source

pub fn get_mapping(&self) -> &Arc<CategoricalMapping>

Available on crate feature dtype-categorical only.

Get a reference to the mapping of categorical types to the string values.

Source

pub fn iter_str(&self) -> impl PolarsIterator<Item = Option<&str>>

Available on crate feature dtype-categorical only.

Create an Iterator that iterates over the &str values of the CategoricalChunked.

Source

pub fn from_str_iter<'a, I: IntoIterator<Item = Option<&'a str>>>( name: PlSmallStr, dtype: DataType, strings: I, ) -> PolarsResult<Self>

Available on crate feature dtype-categorical only.

Converts from strings to this CategoricalChunked.

If this dtype is an Enum any non-existing strings get mapped to null.

Source

pub fn to_arrow(&self, compat_level: CompatLevel) -> DictionaryArray<T::Native>

Available on crate feature dtype-categorical only.
Source§

impl Logical<DecimalType, Int128Type>

Source

pub fn precision(&self) -> usize

Available on crate feature dtype-decimal only.
Source

pub fn scale(&self) -> usize

Available on crate feature dtype-decimal only.
Source

pub fn with_prec_scale( &self, prec: usize, scale: usize, strict: bool, ) -> PolarsResult<Cow<'_, Self>>

Available on crate feature dtype-decimal only.
Source

pub fn into_phys_with_prec_scale_or_sentinel( &self, prec: usize, scale: usize, sentinel: i128, ) -> Int128Chunked

Available on crate feature dtype-decimal only.

Converts self to a physical representation with the given precision and scale, returning the given sentinel value instead for values which don’t fit in the given precision and scale. This can be useful for comparisons.

Source§

impl<K: PolarsDataType, T: PolarsDataType> Logical<K, T>

Source

pub unsafe fn new_logical( phys: ChunkedArray<T>, dtype: DataType, ) -> Logical<K, T>

§Safety

You must uphold the logical types’ invariants.

Source§

impl<K: PolarsDataType, T: PolarsDataType> Logical<K, T>
where Self: LogicalType,

Source

pub fn name(&self) -> &PlSmallStr

Source

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

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn null_count(&self) -> usize

Source

pub fn has_nulls(&self) -> bool

Source

pub fn is_null(&self) -> BooleanChunked

Source

pub fn is_not_null(&self) -> BooleanChunked

Source

pub fn split_at(&self, offset: i64) -> (Self, Self)

Source

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

Source

pub fn field(&self) -> Field

Source

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

Source

pub fn physical_mut(&mut self) -> &mut ChunkedArray<T>

Source

pub fn into_physical(self) -> ChunkedArray<T>

Trait Implementations§

Source§

impl<T: PolarsCategoricalType> ChunkCompareEq<&Logical<T, <T as PolarsCategoricalType>::PolarsPhysical>> for CategoricalChunked<T>

Available on crate feature dtype-categorical only.
Source§

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

Source§

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

Check for equality.
Source§

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

Check for equality where None == None.
Source§

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

Check for inequality.
Source§

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

Check for inequality where None == None.
Source§

impl<T: PolarsCategoricalType> ChunkCompareIneq<&Logical<T, <T as PolarsCategoricalType>::PolarsPhysical>> for CategoricalChunked<T>

Available on crate feature dtype-categorical only.
Source§

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

Source§

fn gt(&self, rhs: &CategoricalChunked<T>) -> Self::Item

Greater than comparison.
Source§

fn gt_eq(&self, rhs: &CategoricalChunked<T>) -> Self::Item

Greater than or equal comparison.
Source§

fn lt(&self, rhs: &CategoricalChunked<T>) -> Self::Item

Less than comparison.
Source§

fn lt_eq(&self, rhs: &CategoricalChunked<T>) -> Self::Item

Less than or equal comparison
Source§

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

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, Physical: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoColumn for T
where T: IntoSeries,

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

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

Source§

fn align() -> usize

The alignment necessary for the key. Must return a power of two.
Source§

fn size(&self) -> usize

The size of the key in bytes.
Source§

unsafe fn init(&self, ptr: *mut u8)

Initialize the key in the given memory location. Read more
Source§

unsafe fn get<'a>(ptr: *const u8) -> &'a T

Get a reference to the key from the given memory location. Read more
Source§

unsafe fn drop_in_place(ptr: *mut u8)

Drop the key in place. 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,

Source§

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

Source§

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

Source§

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