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: DataTypeImplementations§
Source§impl<T: PolarsCategoricalType> CategoricalChunked<T>
impl<T: PolarsCategoricalType> CategoricalChunked<T>
pub fn sort_with(&self, options: SortOptions) -> CategoricalChunked<T>
Sourcepub fn sort(&self, descending: bool) -> CategoricalChunked<T>
pub fn sort(&self, descending: bool) -> CategoricalChunked<T>
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<T: PolarsCategoricalType> CategoricalChunked<T>
impl<T: PolarsCategoricalType> CategoricalChunked<T>
pub fn is_enum(&self) -> bool
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.
pub fn full_null_with_dtype( name: PlSmallStr, length: usize, dtype: DataType, ) -> Self
Sourcepub fn from_cats_and_dtype(
cat_ids: ChunkedArray<T::PolarsPhysical>,
dtype: DataType,
) -> Self
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.
Sourcepub unsafe fn from_cats_and_dtype_unchecked(
cat_ids: ChunkedArray<T::PolarsPhysical>,
dtype: DataType,
) -> Self
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.
Sourcepub fn get_mapping(&self) -> &Arc<CategoricalMapping>
pub fn get_mapping(&self) -> &Arc<CategoricalMapping>
Get a reference to the mapping of categorical types to the string values.
Sourcepub fn iter_str(&self) -> impl PolarsIterator<Item = Option<&str>>
pub fn iter_str(&self) -> impl PolarsIterator<Item = Option<&str>>
Create an Iterator that iterates over the &str values of the CategoricalChunked.
Sourcepub fn from_str_iter<'a, I: IntoIterator<Item = Option<&'a str>>>(
name: PlSmallStr,
dtype: DataType,
strings: I,
) -> PolarsResult<Self>
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.
pub fn to_arrow(&self, compat_level: CompatLevel) -> DictionaryArray<T::Native>
Trait Implementations§
Source§impl<T: PolarsCategoricalType> ChunkAggSeries for CategoricalChunked<T>
impl<T: PolarsCategoricalType> ChunkAggSeries for CategoricalChunked<T>
Source§fn min_reduce(&self) -> Scalar
fn min_reduce(&self) -> Scalar
Get the min of the
ChunkedArray as a new Series of length 1.Source§fn max_reduce(&self) -> Scalar
fn max_reduce(&self) -> Scalar
Get the max of the
ChunkedArray as a new Series of length 1.Source§fn sum_reduce(&self) -> Scalar
fn sum_reduce(&self) -> Scalar
Get the sum of the
ChunkedArray as a new Series of length 1.Source§fn prod_reduce(&self) -> Scalar
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>
impl<T: PolarsCategoricalType> ChunkCompareEq<&ChunkedArray<StringType>> for CategoricalChunked<T>
type Item = ChunkedArray<BooleanType>
Source§fn equal(&self, rhs: &StringChunked) -> Self::Item
fn equal(&self, rhs: &StringChunked) -> Self::Item
Check for equality.
Source§fn equal_missing(&self, rhs: &StringChunked) -> Self::Item
fn equal_missing(&self, rhs: &StringChunked) -> Self::Item
Check for equality where
None == None.Source§fn not_equal(&self, rhs: &StringChunked) -> Self::Item
fn not_equal(&self, rhs: &StringChunked) -> Self::Item
Check for inequality.
Source§fn not_equal_missing(&self, rhs: &StringChunked) -> Self::Item
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>where
ChunkedArray<T::PolarsPhysical>: for<'a> ChunkCompareEq<&'a ChunkedArray<T::PolarsPhysical>, Item = BooleanChunked>,
impl<T: PolarsCategoricalType> ChunkCompareEq<&Logical<T, <T as PolarsCategoricalType>::PolarsPhysical>> for CategoricalChunked<T>where
ChunkedArray<T::PolarsPhysical>: for<'a> ChunkCompareEq<&'a ChunkedArray<T::PolarsPhysical>, Item = BooleanChunked>,
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§fn equal_missing(&self, rhs: &Self) -> Self::Item
fn equal_missing(&self, rhs: &Self) -> Self::Item
Check for equality where
None == None.Source§fn not_equal_missing(&self, rhs: &Self) -> Self::Item
fn not_equal_missing(&self, rhs: &Self) -> Self::Item
Check for inequality where
None == None.Source§impl<T: PolarsCategoricalType> ChunkCompareEq<&str> for CategoricalChunked<T>
impl<T: PolarsCategoricalType> ChunkCompareEq<&str> for CategoricalChunked<T>
type Item = ChunkedArray<BooleanType>
Source§fn equal_missing(&self, rhs: &str) -> Self::Item
fn equal_missing(&self, rhs: &str) -> Self::Item
Check for equality where
None == None.Source§fn not_equal_missing(&self, rhs: &str) -> Self::Item
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>
impl<T: PolarsCategoricalType> ChunkCompareIneq<&ChunkedArray<StringType>> for CategoricalChunked<T>
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§fn gt(&self, rhs: &StringChunked) -> Self::Item
fn gt(&self, rhs: &StringChunked) -> Self::Item
Greater than comparison.
Source§fn gt_eq(&self, rhs: &StringChunked) -> Self::Item
fn gt_eq(&self, rhs: &StringChunked) -> Self::Item
Greater than or equal comparison.
Source§fn lt(&self, rhs: &StringChunked) -> Self::Item
fn lt(&self, rhs: &StringChunked) -> Self::Item
Less than comparison.
Source§fn lt_eq(&self, rhs: &StringChunked) -> Self::Item
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>where
ChunkedArray<T::PolarsPhysical>: for<'a> ChunkCompareIneq<&'a ChunkedArray<T::PolarsPhysical>, Item = BooleanChunked>,
impl<T: PolarsCategoricalType> ChunkCompareIneq<&Logical<T, <T as PolarsCategoricalType>::PolarsPhysical>> for CategoricalChunked<T>where
ChunkedArray<T::PolarsPhysical>: for<'a> ChunkCompareIneq<&'a ChunkedArray<T::PolarsPhysical>, Item = BooleanChunked>,
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§fn gt(&self, rhs: &CategoricalChunked<T>) -> Self::Item
fn gt(&self, rhs: &CategoricalChunked<T>) -> Self::Item
Greater than comparison.
Source§fn gt_eq(&self, rhs: &CategoricalChunked<T>) -> Self::Item
fn gt_eq(&self, rhs: &CategoricalChunked<T>) -> Self::Item
Greater than or equal comparison.
Source§fn lt(&self, rhs: &CategoricalChunked<T>) -> Self::Item
fn lt(&self, rhs: &CategoricalChunked<T>) -> Self::Item
Less than comparison.
Source§fn lt_eq(&self, rhs: &CategoricalChunked<T>) -> Self::Item
fn lt_eq(&self, rhs: &CategoricalChunked<T>) -> Self::Item
Less than or equal comparison
Source§impl<T: PolarsCategoricalType> ChunkCompareIneq<&str> for CategoricalChunked<T>
impl<T: PolarsCategoricalType> ChunkCompareIneq<&str> for CategoricalChunked<T>
type Item = ChunkedArray<BooleanType>
Source§impl<T: PolarsCategoricalType> IntoSeries for CategoricalChunked<T>
impl<T: PolarsCategoricalType> IntoSeries for CategoricalChunked<T>
Source§impl<T: PolarsCategoricalType> LogicalType for CategoricalChunked<T>
impl<T: PolarsCategoricalType> LogicalType for CategoricalChunked<T>
Source§fn dtype(&self) -> &DataType
fn dtype(&self) -> &DataType
Get data type of
ChunkedArray.Source§fn get_any_value(&self, i: usize) -> PolarsResult<AnyValue<'_>>
fn get_any_value(&self, i: usize) -> PolarsResult<AnyValue<'_>>
Gets
AnyValue from LogicalTypefn cast_with_options( &self, dtype: &DataType, options: CastOptions, ) -> PolarsResult<Series>
fn cast(&self, dtype: &DataType) -> PolarsResult<Series>
Source§impl<T: PolarsCategoricalType> VecHash for CategoricalChunked<T>
impl<T: PolarsCategoricalType> VecHash for CategoricalChunked<T>
Source§fn vec_hash(
&self,
random_state: PlSeedableRandomStateQuality,
buf: &mut Vec<u64>,
) -> PolarsResult<()>
fn vec_hash( &self, random_state: PlSeedableRandomStateQuality, buf: &mut Vec<u64>, ) -> PolarsResult<()>
Compute the hash for all values in the array.