CategoricalChunked

Type Alias CategoricalChunked 

Source
pub type CategoricalChunked<T> = Logical<T, <T as PolarsCategoricalType>::PolarsPhysical>;
Available on crate feature dtype-categorical only.

Aliased Type§

pub struct CategoricalChunked<T> {
    pub phys: ChunkedArray<<T as PolarsCategoricalType>::PolarsPhysical>,
    pub dtype: DataType,
    /* private fields */
}

Fields§

§phys: ChunkedArray<<T as PolarsCategoricalType>::PolarsPhysical>§dtype: DataType

Implementations§

Source§

impl<T: PolarsCategoricalType> CategoricalChunked<T>

Source

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

Source

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

Returned a sorted ChunkedArray.

Source

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

Retrieve the indexes needed to sort this array.

Source§

impl<T: PolarsCategoricalType> CategoricalChunked<T>

Source

pub fn is_enum(&self) -> bool

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 fn full_null_with_dtype( name: PlSmallStr, length: usize, dtype: DataType, ) -> Self

Source

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

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

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>

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

Source

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

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>

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>

Trait Implementations§

Source§

impl<T: PolarsCategoricalType> ChunkAggSeries for CategoricalChunked<T>

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<T: PolarsCategoricalType> ChunkCompareEq<&ChunkedArray<StringType>> for CategoricalChunked<T>

Source§

type Item = ChunkedArray<BooleanType>

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§

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

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

Source§

type Item = ChunkedArray<BooleanType>

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§

impl<T: PolarsCategoricalType> ChunkCompareIneq<&ChunkedArray<StringType>> for CategoricalChunked<T>

Source§

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

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<T: PolarsCategoricalType> ChunkCompareIneq<&Logical<T, <T as PolarsCategoricalType>::PolarsPhysical>> for CategoricalChunked<T>

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<T: PolarsCategoricalType> ChunkCompareIneq<&str> for CategoricalChunked<T>

Source§

type Item = ChunkedArray<BooleanType>

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<T: PolarsCategoricalType> IntoSeries for CategoricalChunked<T>

Source§

impl<T: PolarsCategoricalType> LogicalType for CategoricalChunked<T>

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>

Source§

impl<T: PolarsCategoricalType> VecHash for CategoricalChunked<T>

Source§

fn vec_hash( &self, random_state: PlSeedableRandomStateQuality, buf: &mut Vec<u64>, ) -> PolarsResult<()>

Compute the hash for all values in the array.
Source§

fn vec_hash_combine( &self, random_state: PlSeedableRandomStateQuality, hashes: &mut [u64], ) -> PolarsResult<()>