polars::prelude::datatypes

Struct CategoricalChunked

Source
pub struct CategoricalChunked { /* private fields */ }

Implementations§

Source§

impl CategoricalChunked

Source

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

Available on crate feature dtype-categorical only.
Source

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

Available on crate feature dtype-categorical only.

Returned a sorted ChunkedArray.

Source

pub fn arg_sort(&self, options: SortOptions) -> ChunkedArray<UInt32Type>

Available on crate feature dtype-categorical only.

Retrieve the indexes needed to sort this array.

Source§

impl CategoricalChunked

Source

pub unsafe fn from_global_indices_unchecked( cats: ChunkedArray<UInt32Type>, ordering: CategoricalOrdering, ) -> CategoricalChunked

Available on crate feature dtype-categorical only.

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: &ChunkedArray<StringType>, categories: &BinaryViewArrayGeneric<str>, ordering: CategoricalOrdering, ) -> Result<CategoricalChunked, PolarsError>

Available on crate feature dtype-categorical only.

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, compat_level: CompatLevel, as_i64: bool, ) -> Box<dyn Array>

Available on crate feature dtype-categorical only.
Source§

impl CategoricalChunked

Source

pub fn append(&mut self, other: &CategoricalChunked) -> Result<(), PolarsError>

Available on crate feature dtype-categorical only.
Source§

impl CategoricalChunked

Source

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

Available on crate feature dtype-categorical only.
Source§

impl CategoricalChunked

Source

pub fn unique(&self) -> Result<CategoricalChunked, PolarsError>

Available on crate feature dtype-categorical only.
Source

pub fn n_unique(&self) -> Result<usize, PolarsError>

Available on crate feature dtype-categorical only.
Source

pub fn value_counts(&self) -> Result<DataFrame, PolarsError>

Available on crate feature dtype-categorical only.
Source§

impl CategoricalChunked

Source

pub fn is_empty(&self) -> bool

Available on crate feature dtype-categorical only.
Source

pub fn len(&self) -> usize

Available on crate feature dtype-categorical only.
Source

pub fn null_count(&self) -> usize

Available on crate feature dtype-categorical only.
Source

pub fn name(&self) -> &PlSmallStr

Available on crate feature dtype-categorical only.
Source

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

Available on crate feature dtype-categorical only.

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

Source

pub fn is_enum(&self) -> bool

Available on crate feature dtype-categorical only.
Source

pub fn to_local(&self) -> CategoricalChunked

Available on crate feature dtype-categorical only.

Convert a categorical column to its local representation.

Source

pub fn to_global(&self) -> Result<CategoricalChunked, PolarsError>

Available on crate feature dtype-categorical only.
Source

pub fn to_enum( &self, categories: &BinaryViewArrayGeneric<str>, hash: u128, ) -> CategoricalChunked

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 unsafe fn from_cats_and_dtype_unchecked( idx: ChunkedArray<UInt32Type>, dtype: DataType, ) -> CategoricalChunked

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 unsafe fn from_cats_and_rev_map_unchecked( idx: ChunkedArray<UInt32Type>, rev_map: Arc<RevMapping>, is_enum: bool, ordering: CategoricalOrdering, ) -> CategoricalChunked

Available on crate feature dtype-categorical only.

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

Available on crate feature dtype-categorical only.

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

Available on crate feature dtype-categorical only.
Source

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

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) -> CatIter<'_>

Available on crate feature dtype-categorical only.

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

Trait Implementations§

Source§

impl ChunkAggSeries for CategoricalChunked

Available on crate feature dtype-categorical only.
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 ChunkCompareEq<&CategoricalChunked> for CategoricalChunked

Source§

impl ChunkCompareEq<&ChunkedArray<StringType>> for CategoricalChunked

Source§

impl ChunkCompareEq<&str> for CategoricalChunked

Source§

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

Source§

fn equal(&self, rhs: &str) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item

Check for equality.
Source§

fn equal_missing( &self, rhs: &str, ) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item

Check for equality where None == None.
Source§

fn not_equal( &self, rhs: &str, ) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item

Check for inequality.
Source§

fn not_equal_missing( &self, rhs: &str, ) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item

Check for inequality where None == None.
Source§

impl ChunkCompareIneq<&CategoricalChunked> for CategoricalChunked

Source§

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

Source§

fn gt( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item

Greater than comparison.
Source§

fn gt_eq( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item

Greater than or equal comparison.
Source§

fn lt( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item

Less than comparison.
Source§

fn lt_eq( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item

Less than or equal comparison
Source§

impl ChunkCompareIneq<&ChunkedArray<StringType>> for CategoricalChunked

Source§

impl ChunkCompareIneq<&str> for CategoricalChunked

Source§

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

Source§

fn gt(&self, rhs: &str) -> <CategoricalChunked as ChunkCompareIneq<&str>>::Item

Greater than comparison.
Source§

fn gt_eq( &self, rhs: &str, ) -> <CategoricalChunked as ChunkCompareIneq<&str>>::Item

Greater than or equal comparison.
Source§

fn lt(&self, rhs: &str) -> <CategoricalChunked as ChunkCompareIneq<&str>>::Item

Less than comparison.
Source§

fn lt_eq( &self, rhs: &str, ) -> <CategoricalChunked as ChunkCompareIneq<&str>>::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) -> 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, options: CastOptions, ) -> Result<Series, PolarsError>

Source§

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

Source§

impl Serialize for CategoricalChunked

Available on crate feature dtype-categorical only.
Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

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

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

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

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T