Struct polars_core::prelude::CategoricalChunked

source ·
pub struct CategoricalChunked { /* private fields */ }
Available on crate feature dtype-categorical only.

Implementations§

source§

impl CategoricalChunked

source

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

source

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

Returned a sorted ChunkedArray.

source

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

Retrieve the indexes needed to sort this array.

source§

impl CategoricalChunked

source

pub unsafe fn from_global_indices_unchecked( cats: UInt32Chunked, ordering: CategoricalOrdering ) -> CategoricalChunked

Create a CategoricalChunked from a categorical indices. The indices will probe the global string cache.

§Safety

This does not do any bound checks

source

pub fn from_string_to_enum( values: &StringChunked, categories: &Utf8ViewArray, ordering: CategoricalOrdering ) -> PolarsResult<CategoricalChunked>

Create a CategoricalChunked from a fixed list of categories and a List of strings. This will error if a string is not in the fixed list of categories

source§

impl CategoricalChunked

source

pub fn to_arrow(&self, pl_flavor: bool, as_i64: bool) -> ArrayRef

source§

impl CategoricalChunked

source

pub fn append(&mut self, other: &Self) -> PolarsResult<()>

source§

impl CategoricalChunked

source

pub fn full_null( name: &str, is_enum: bool, length: usize, ordering: CategoricalOrdering ) -> CategoricalChunked

source§

impl CategoricalChunked

source

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

Available on crate feature algorithm_group_by only.
source

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

Available on crate feature algorithm_group_by only.
source

pub fn value_counts(&self) -> PolarsResult<DataFrame>

Available on crate feature algorithm_group_by only.
source§

impl CategoricalChunked

source

pub fn is_empty(&self) -> bool

source

pub fn len(&self) -> usize

source

pub fn null_count(&self) -> usize

source

pub fn name(&self) -> &str

source

pub fn physical(&self) -> &UInt32Chunked

Get a reference to the physical array (the categories).

source

pub fn is_enum(&self) -> bool

source

pub fn to_local(&self) -> Self

Convert a categorical column to its local representation.

source

pub fn to_global(&self) -> PolarsResult<Self>

source

pub fn to_enum(&self, categories: &Utf8ViewArray, hash: u128) -> Self

source

pub fn uses_lexical_ordering(&self) -> bool

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

source

pub unsafe fn from_cats_and_rev_map_unchecked( idx: UInt32Chunked, rev_map: Arc<RevMapping>, is_enum: bool, ordering: CategoricalOrdering ) -> Self

Create a CategoricalChunked from an array of idx and an existing RevMapping: rev_map.

§Safety

Invariant in v < rev_map.len() for v in idx must hold.

source

pub fn _can_fast_unique(&self) -> bool

True if all categories are represented in this array. When this is the case, the unique values of the array are the categories.

source

pub fn _with_fast_unique(self, toggle: bool) -> Self

source

pub fn get_rev_map(&self) -> &Arc<RevMapping>

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

source

pub fn iter_str(&self) -> CatIter<'_>

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

Trait Implementations§

source§

impl ChunkAggSeries for CategoricalChunked

source§

fn min_reduce(&self) -> Scalar

Get the min 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 sum_reduce(&self) -> Scalar

Get the sum 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 ChunkCompare<&CategoricalChunked> for CategoricalChunked

§

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

source§

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

Check for equality.
source§

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

Check for equality where None == None.
source§

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

Check for inequality.
source§

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

Check for inequality where None == None.
source§

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

Greater than comparison.
source§

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

Greater than or equal comparison.
source§

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

Less than comparison.
source§

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

Less than or equal comparison
source§

impl ChunkCompare<&ChunkedArray<StringType>> for CategoricalChunked

§

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<&str> for CategoricalChunked

§

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

source§

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

Check for equality.
source§

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

Check for equality where None == None.
source§

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

Check for inequality.
source§

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

Check for inequality where None == None.
source§

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

Greater than comparison.
source§

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

Greater than or equal comparison.
source§

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

Less than comparison.
source§

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

Less than or equal comparison
source§

impl Clone for CategoricalChunked

source§

fn clone(&self) -> CategoricalChunked

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 IntoSeries for CategoricalChunked

source§

impl LogicalType for CategoricalChunked

source§

fn dtype(&self) -> &DataType

Get data type of ChunkedArray.
source§

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

source§

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

Safety Read more
source§

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

source§

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

Auto Trait Implementations§

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