Struct polars_core::datatypes::CategoricalChunked
source · pub struct CategoricalChunked { /* private fields */ }
dtype-categorical
only.Implementations§
source§impl CategoricalChunked
impl CategoricalChunked
pub fn sort_with(&self, options: SortOptions) -> CategoricalChunked
sourcepub fn sort(&self, descending: bool) -> CategoricalChunked
pub fn sort(&self, descending: bool) -> CategoricalChunked
Returned a sorted ChunkedArray
.
sourcepub fn arg_sort(&self, options: SortOptions) -> IdxCa
pub fn arg_sort(&self, options: SortOptions) -> IdxCa
Retrieve the indexes needed to sort this array.
source§impl CategoricalChunked
impl CategoricalChunked
sourcepub unsafe fn from_global_indices_unchecked(
cats: UInt32Chunked,
ordering: CategoricalOrdering
) -> CategoricalChunked
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
sourcepub fn from_string_to_enum(
values: &StringChunked,
categories: &Utf8ViewArray,
ordering: CategoricalOrdering
) -> PolarsResult<CategoricalChunked>
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
impl CategoricalChunked
pub fn append(&mut self, other: &Self) -> PolarsResult<()>
source§impl CategoricalChunked
impl CategoricalChunked
pub fn full_null( name: &str, is_enum: bool, length: usize, ordering: CategoricalOrdering ) -> CategoricalChunked
source§impl CategoricalChunked
impl CategoricalChunked
pub fn unique(&self) -> PolarsResult<Self>
algorithm_group_by
only.pub fn n_unique(&self) -> PolarsResult<usize>
algorithm_group_by
only.pub fn value_counts(&self) -> PolarsResult<DataFrame>
algorithm_group_by
only.source§impl CategoricalChunked
impl CategoricalChunked
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn null_count(&self) -> usize
pub fn name(&self) -> &str
sourcepub fn physical(&self) -> &UInt32Chunked
pub fn physical(&self) -> &UInt32Chunked
Get a reference to the physical array (the categories).
pub fn is_enum(&self) -> bool
pub fn to_global(&self) -> PolarsResult<Self>
pub fn to_enum(&self, categories: &Utf8ViewArray, hash: u128) -> Self
sourcepub fn uses_lexical_ordering(&self) -> bool
pub fn uses_lexical_ordering(&self) -> bool
Return whether or not the CategoricalChunked
uses the lexical order
of the string values when sorting.
sourcepub unsafe fn from_cats_and_rev_map_unchecked(
idx: UInt32Chunked,
rev_map: Arc<RevMapping>,
is_enum: bool,
ordering: CategoricalOrdering
) -> Self
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.
sourcepub fn _can_fast_unique(&self) -> bool
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.
pub fn _with_fast_unique(self, toggle: bool) -> Self
sourcepub fn get_rev_map(&self) -> &Arc<RevMapping>
pub fn get_rev_map(&self) -> &Arc<RevMapping>
Get a reference to the mapping of categorical types to the string values.
Trait Implementations§
source§impl ChunkAggSeries for CategoricalChunked
impl ChunkAggSeries for CategoricalChunked
source§fn min_reduce(&self) -> Scalar
fn min_reduce(&self) -> Scalar
ChunkedArray
as a new Series
of length 1.source§fn max_reduce(&self) -> Scalar
fn max_reduce(&self) -> Scalar
ChunkedArray
as a new Series
of length 1.source§fn sum_reduce(&self) -> Scalar
fn sum_reduce(&self) -> Scalar
ChunkedArray
as a new Series
of length 1.source§fn prod_reduce(&self) -> Scalar
fn prod_reduce(&self) -> Scalar
ChunkedArray
as a new Series
of length 1.source§impl ChunkCompare<&CategoricalChunked> for CategoricalChunked
impl ChunkCompare<&CategoricalChunked> for CategoricalChunked
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
source§fn equal(&self, rhs: &CategoricalChunked) -> Self::Item
fn equal(&self, rhs: &CategoricalChunked) -> Self::Item
source§fn equal_missing(&self, rhs: &CategoricalChunked) -> Self::Item
fn equal_missing(&self, rhs: &CategoricalChunked) -> Self::Item
None == None
.source§fn not_equal(&self, rhs: &CategoricalChunked) -> Self::Item
fn not_equal(&self, rhs: &CategoricalChunked) -> Self::Item
source§fn not_equal_missing(&self, rhs: &CategoricalChunked) -> Self::Item
fn not_equal_missing(&self, rhs: &CategoricalChunked) -> Self::Item
None == None
.source§fn gt(&self, rhs: &CategoricalChunked) -> Self::Item
fn gt(&self, rhs: &CategoricalChunked) -> Self::Item
source§fn gt_eq(&self, rhs: &CategoricalChunked) -> Self::Item
fn gt_eq(&self, rhs: &CategoricalChunked) -> Self::Item
source§fn lt(&self, rhs: &CategoricalChunked) -> Self::Item
fn lt(&self, rhs: &CategoricalChunked) -> Self::Item
source§fn lt_eq(&self, rhs: &CategoricalChunked) -> Self::Item
fn lt_eq(&self, rhs: &CategoricalChunked) -> Self::Item
source§impl ChunkCompare<&ChunkedArray<StringType>> for CategoricalChunked
impl ChunkCompare<&ChunkedArray<StringType>> for CategoricalChunked
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
source§fn equal(&self, rhs: &StringChunked) -> Self::Item
fn equal(&self, rhs: &StringChunked) -> Self::Item
source§fn equal_missing(&self, rhs: &StringChunked) -> Self::Item
fn equal_missing(&self, rhs: &StringChunked) -> Self::Item
None == None
.source§fn not_equal(&self, rhs: &StringChunked) -> Self::Item
fn not_equal(&self, rhs: &StringChunked) -> Self::Item
source§fn not_equal_missing(&self, rhs: &StringChunked) -> Self::Item
fn not_equal_missing(&self, rhs: &StringChunked) -> Self::Item
None == None
.source§fn gt(&self, rhs: &StringChunked) -> Self::Item
fn gt(&self, rhs: &StringChunked) -> Self::Item
source§fn gt_eq(&self, rhs: &StringChunked) -> Self::Item
fn gt_eq(&self, rhs: &StringChunked) -> Self::Item
source§fn lt(&self, rhs: &StringChunked) -> Self::Item
fn lt(&self, rhs: &StringChunked) -> Self::Item
source§fn lt_eq(&self, rhs: &StringChunked) -> Self::Item
fn lt_eq(&self, rhs: &StringChunked) -> Self::Item
source§impl ChunkCompare<&str> for CategoricalChunked
impl ChunkCompare<&str> for CategoricalChunked
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
source§fn equal_missing(&self, rhs: &str) -> Self::Item
fn equal_missing(&self, rhs: &str) -> Self::Item
None == None
.source§fn not_equal_missing(&self, rhs: &str) -> Self::Item
fn not_equal_missing(&self, rhs: &str) -> Self::Item
None == None
.source§impl Clone for CategoricalChunked
impl Clone for CategoricalChunked
source§fn clone(&self) -> CategoricalChunked
fn clone(&self) -> CategoricalChunked
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl IntoSeries for CategoricalChunked
impl IntoSeries for CategoricalChunked
source§impl LogicalType for CategoricalChunked
impl LogicalType for CategoricalChunked
source§fn dtype(&self) -> &DataType
fn dtype(&self) -> &DataType
ChunkedArray
.source§fn get_any_value(&self, i: usize) -> PolarsResult<AnyValue<'_>>
fn get_any_value(&self, i: usize) -> PolarsResult<AnyValue<'_>>
AnyValue
from LogicalType
fn cast_with_options( &self, dtype: &DataType, options: CastOptions ) -> PolarsResult<Series>
fn cast(&self, dtype: &DataType) -> PolarsResult<Series>
Auto Trait Implementations§
impl Freeze for CategoricalChunked
impl !RefUnwindSafe for CategoricalChunked
impl Send for CategoricalChunked
impl Sync for CategoricalChunked
impl Unpin for CategoricalChunked
impl !UnwindSafe for CategoricalChunked
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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