pub struct CategoricalChunked { /* private fields */ }
Implementations§
Source§impl CategoricalChunked
impl CategoricalChunked
pub fn sort_with(&self, options: SortOptions) -> CategoricalChunked
dtype-categorical
only.Sourcepub fn sort(&self, descending: bool) -> CategoricalChunked
Available on crate feature dtype-categorical
only.
pub fn sort(&self, descending: bool) -> CategoricalChunked
dtype-categorical
only.Returned a sorted ChunkedArray
.
Sourcepub fn arg_sort(&self, options: SortOptions) -> ChunkedArray<UInt32Type>
Available on crate feature dtype-categorical
only.
pub fn arg_sort(&self, options: SortOptions) -> ChunkedArray<UInt32Type>
dtype-categorical
only.Retrieve the indexes needed to sort this array.
Source§impl CategoricalChunked
impl CategoricalChunked
Sourcepub unsafe fn from_global_indices_unchecked(
cats: ChunkedArray<UInt32Type>,
ordering: CategoricalOrdering,
) -> CategoricalChunked
Available on crate feature dtype-categorical
only.
pub unsafe fn from_global_indices_unchecked( cats: ChunkedArray<UInt32Type>, ordering: CategoricalOrdering, ) -> CategoricalChunked
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
Sourcepub fn from_string_to_enum(
values: &ChunkedArray<StringType>,
categories: &BinaryViewArrayGeneric<str>,
ordering: CategoricalOrdering,
) -> Result<CategoricalChunked, PolarsError>
Available on crate feature dtype-categorical
only.
pub fn from_string_to_enum( values: &ChunkedArray<StringType>, categories: &BinaryViewArrayGeneric<str>, ordering: CategoricalOrdering, ) -> Result<CategoricalChunked, PolarsError>
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
impl CategoricalChunked
pub fn to_arrow( &self, compat_level: CompatLevel, as_i64: bool, ) -> Box<dyn Array>
dtype-categorical
only.Source§impl CategoricalChunked
impl CategoricalChunked
pub fn append(&mut self, other: &CategoricalChunked) -> Result<(), PolarsError>
dtype-categorical
only.Source§impl CategoricalChunked
impl CategoricalChunked
pub fn full_null( name: PlSmallStr, is_enum: bool, length: usize, ordering: CategoricalOrdering, ) -> CategoricalChunked
dtype-categorical
only.Source§impl CategoricalChunked
impl CategoricalChunked
pub fn unique(&self) -> Result<CategoricalChunked, PolarsError>
dtype-categorical
only.pub fn n_unique(&self) -> Result<usize, PolarsError>
dtype-categorical
only.pub fn value_counts(&self) -> Result<DataFrame, PolarsError>
dtype-categorical
only.Source§impl CategoricalChunked
impl CategoricalChunked
pub fn is_empty(&self) -> bool
dtype-categorical
only.pub fn len(&self) -> usize
dtype-categorical
only.pub fn null_count(&self) -> usize
dtype-categorical
only.pub fn name(&self) -> &PlSmallStr
dtype-categorical
only.Sourcepub fn physical(&self) -> &ChunkedArray<UInt32Type>
Available on crate feature dtype-categorical
only.
pub fn physical(&self) -> &ChunkedArray<UInt32Type>
dtype-categorical
only.Get a reference to the physical array (the categories).
pub fn is_enum(&self) -> bool
dtype-categorical
only.Sourcepub fn to_local(&self) -> CategoricalChunked
Available on crate feature dtype-categorical
only.
pub fn to_local(&self) -> CategoricalChunked
dtype-categorical
only.Convert a categorical column to its local representation.
pub fn to_global(&self) -> Result<CategoricalChunked, PolarsError>
dtype-categorical
only.pub fn to_enum( &self, categories: &BinaryViewArrayGeneric<str>, hash: u128, ) -> CategoricalChunked
dtype-categorical
only.Sourcepub fn uses_lexical_ordering(&self) -> bool
Available on crate feature dtype-categorical
only.
pub fn uses_lexical_ordering(&self) -> bool
dtype-categorical
only.Return whether or not the CategoricalChunked
uses the lexical order
of the string values when sorting.
Sourcepub unsafe fn from_cats_and_dtype_unchecked(
idx: ChunkedArray<UInt32Type>,
dtype: DataType,
) -> CategoricalChunked
Available on crate feature dtype-categorical
only.
pub unsafe fn from_cats_and_dtype_unchecked( idx: ChunkedArray<UInt32Type>, dtype: DataType, ) -> CategoricalChunked
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.
Sourcepub 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.
pub unsafe fn from_cats_and_rev_map_unchecked( idx: ChunkedArray<UInt32Type>, rev_map: Arc<RevMapping>, is_enum: bool, ordering: CategoricalOrdering, ) -> CategoricalChunked
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.
Sourcepub fn _can_fast_unique(&self) -> bool
Available on crate feature dtype-categorical
only.
pub fn _can_fast_unique(&self) -> bool
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.
pub fn _with_fast_unique(self, toggle: bool) -> CategoricalChunked
dtype-categorical
only.Sourcepub fn get_rev_map(&self) -> &Arc<RevMapping>
Available on crate feature dtype-categorical
only.
pub fn get_rev_map(&self) -> &Arc<RevMapping>
dtype-categorical
only.Get a reference to the mapping of categorical types to the string values.
Trait Implementations§
Source§impl ChunkAggSeries for CategoricalChunked
Available on crate feature dtype-categorical
only.
impl ChunkAggSeries for CategoricalChunked
dtype-categorical
only.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 ChunkCompareEq<&CategoricalChunked> for CategoricalChunked
impl ChunkCompareEq<&CategoricalChunked> for CategoricalChunked
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§fn equal(
&self,
rhs: &CategoricalChunked,
) -> <CategoricalChunked as ChunkCompareEq<&CategoricalChunked>>::Item
fn equal( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareEq<&CategoricalChunked>>::Item
Source§fn equal_missing(
&self,
rhs: &CategoricalChunked,
) -> <CategoricalChunked as ChunkCompareEq<&CategoricalChunked>>::Item
fn equal_missing( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareEq<&CategoricalChunked>>::Item
None == None
.Source§fn not_equal(
&self,
rhs: &CategoricalChunked,
) -> <CategoricalChunked as ChunkCompareEq<&CategoricalChunked>>::Item
fn not_equal( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareEq<&CategoricalChunked>>::Item
Source§fn not_equal_missing(
&self,
rhs: &CategoricalChunked,
) -> <CategoricalChunked as ChunkCompareEq<&CategoricalChunked>>::Item
fn not_equal_missing( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareEq<&CategoricalChunked>>::Item
None == None
.Source§impl ChunkCompareEq<&ChunkedArray<StringType>> for CategoricalChunked
impl ChunkCompareEq<&ChunkedArray<StringType>> for CategoricalChunked
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§fn equal(
&self,
rhs: &ChunkedArray<StringType>,
) -> <CategoricalChunked as ChunkCompareEq<&ChunkedArray<StringType>>>::Item
fn equal( &self, rhs: &ChunkedArray<StringType>, ) -> <CategoricalChunked as ChunkCompareEq<&ChunkedArray<StringType>>>::Item
Source§fn equal_missing(
&self,
rhs: &ChunkedArray<StringType>,
) -> <CategoricalChunked as ChunkCompareEq<&ChunkedArray<StringType>>>::Item
fn equal_missing( &self, rhs: &ChunkedArray<StringType>, ) -> <CategoricalChunked as ChunkCompareEq<&ChunkedArray<StringType>>>::Item
None == None
.Source§fn not_equal(
&self,
rhs: &ChunkedArray<StringType>,
) -> <CategoricalChunked as ChunkCompareEq<&ChunkedArray<StringType>>>::Item
fn not_equal( &self, rhs: &ChunkedArray<StringType>, ) -> <CategoricalChunked as ChunkCompareEq<&ChunkedArray<StringType>>>::Item
Source§fn not_equal_missing(
&self,
rhs: &ChunkedArray<StringType>,
) -> <CategoricalChunked as ChunkCompareEq<&ChunkedArray<StringType>>>::Item
fn not_equal_missing( &self, rhs: &ChunkedArray<StringType>, ) -> <CategoricalChunked as ChunkCompareEq<&ChunkedArray<StringType>>>::Item
None == None
.Source§impl ChunkCompareEq<&str> for CategoricalChunked
impl ChunkCompareEq<&str> for CategoricalChunked
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§fn equal(&self, rhs: &str) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item
fn equal(&self, rhs: &str) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item
Source§fn equal_missing(
&self,
rhs: &str,
) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item
fn equal_missing( &self, rhs: &str, ) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item
None == None
.Source§fn not_equal(
&self,
rhs: &str,
) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item
fn not_equal( &self, rhs: &str, ) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item
Source§fn not_equal_missing(
&self,
rhs: &str,
) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item
fn not_equal_missing( &self, rhs: &str, ) -> <CategoricalChunked as ChunkCompareEq<&str>>::Item
None == None
.Source§impl ChunkCompareIneq<&CategoricalChunked> for CategoricalChunked
impl ChunkCompareIneq<&CategoricalChunked> for CategoricalChunked
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§fn gt(
&self,
rhs: &CategoricalChunked,
) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item
fn gt( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item
Source§fn gt_eq(
&self,
rhs: &CategoricalChunked,
) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item
fn gt_eq( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item
Source§fn lt(
&self,
rhs: &CategoricalChunked,
) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item
fn lt( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item
Source§fn lt_eq(
&self,
rhs: &CategoricalChunked,
) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item
fn lt_eq( &self, rhs: &CategoricalChunked, ) -> <CategoricalChunked as ChunkCompareIneq<&CategoricalChunked>>::Item
Source§impl ChunkCompareIneq<&ChunkedArray<StringType>> for CategoricalChunked
impl ChunkCompareIneq<&ChunkedArray<StringType>> for CategoricalChunked
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§fn gt(
&self,
rhs: &ChunkedArray<StringType>,
) -> <CategoricalChunked as ChunkCompareIneq<&ChunkedArray<StringType>>>::Item
fn gt( &self, rhs: &ChunkedArray<StringType>, ) -> <CategoricalChunked as ChunkCompareIneq<&ChunkedArray<StringType>>>::Item
Source§fn gt_eq(
&self,
rhs: &ChunkedArray<StringType>,
) -> <CategoricalChunked as ChunkCompareIneq<&ChunkedArray<StringType>>>::Item
fn gt_eq( &self, rhs: &ChunkedArray<StringType>, ) -> <CategoricalChunked as ChunkCompareIneq<&ChunkedArray<StringType>>>::Item
Source§fn lt(
&self,
rhs: &ChunkedArray<StringType>,
) -> <CategoricalChunked as ChunkCompareIneq<&ChunkedArray<StringType>>>::Item
fn lt( &self, rhs: &ChunkedArray<StringType>, ) -> <CategoricalChunked as ChunkCompareIneq<&ChunkedArray<StringType>>>::Item
Source§fn lt_eq(
&self,
rhs: &ChunkedArray<StringType>,
) -> <CategoricalChunked as ChunkCompareIneq<&ChunkedArray<StringType>>>::Item
fn lt_eq( &self, rhs: &ChunkedArray<StringType>, ) -> <CategoricalChunked as ChunkCompareIneq<&ChunkedArray<StringType>>>::Item
Source§impl ChunkCompareIneq<&str> for CategoricalChunked
impl ChunkCompareIneq<&str> for CategoricalChunked
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§fn gt(&self, rhs: &str) -> <CategoricalChunked as ChunkCompareIneq<&str>>::Item
fn gt(&self, rhs: &str) -> <CategoricalChunked as ChunkCompareIneq<&str>>::Item
Source§fn gt_eq(
&self,
rhs: &str,
) -> <CategoricalChunked as ChunkCompareIneq<&str>>::Item
fn gt_eq( &self, rhs: &str, ) -> <CategoricalChunked as ChunkCompareIneq<&str>>::Item
Source§fn lt(&self, rhs: &str) -> <CategoricalChunked as ChunkCompareIneq<&str>>::Item
fn lt(&self, rhs: &str) -> <CategoricalChunked as ChunkCompareIneq<&str>>::Item
Source§fn lt_eq(
&self,
rhs: &str,
) -> <CategoricalChunked as ChunkCompareIneq<&str>>::Item
fn lt_eq( &self, rhs: &str, ) -> <CategoricalChunked as ChunkCompareIneq<&str>>::Item
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) -> Result<AnyValue<'_>, PolarsError>
fn get_any_value(&self, i: usize) -> Result<AnyValue<'_>, PolarsError>
AnyValue
from LogicalType
fn cast_with_options( &self, dtype: &DataType, options: CastOptions, ) -> Result<Series, PolarsError>
fn cast(&self, dtype: &DataType) -> Result<Series, PolarsError>
Source§impl Serialize for CategoricalChunked
Available on crate feature dtype-categorical
only.
impl Serialize for CategoricalChunked
dtype-categorical
only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoColumn for Twhere
T: IntoSeries,
impl<T> IntoColumn for Twhere
T: IntoSeries,
fn into_column(self) -> Column
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