pub struct CategoricalToArrowConverter {
pub converters: IndexMap<usize, CategoricalArrayToArrowConverter, RandomState>,
pub persist_remap: bool,
pub output_keys_only: bool,
}Expand description
Categorical converter that prunes unused categories.
Fields§
§converters: IndexMap<usize, CategoricalArrayToArrowConverter, RandomState>Converters keyed by the Arc address of Arc<CategoricalMapping>.
§Safety
The usize key remains valid as CategoricalArrayToArrowConverter holds a ref-count to the
Arc<> that the key is derived from.
persist_remap: boolPersist the key remap to ensure consistent mapping across multiple calls.
output_keys_only: boolReturn only the keys array when going to arrow.
Implementations§
Source§impl CategoricalToArrowConverter
impl CategoricalToArrowConverter
Sourcepub fn array_to_arrow(
&mut self,
keys_arr: &(dyn Array + 'static),
dtype: &DataType,
compat_level: CompatLevel,
) -> Box<dyn Array>
pub fn array_to_arrow( &mut self, keys_arr: &(dyn Array + 'static), dtype: &DataType, compat_level: CompatLevel, ) -> Box<dyn Array>
§Panics
Panics if:
keys_arris not of aCategoricalorEnumtype- The arc address of the
Arc<CategoricalMapping>is not present withinself.converters(likely due to forgetting to callinitialize()on this converter).
Sourcepub fn initialize(&mut self, dtype: &DataType)
pub fn initialize(&mut self, dtype: &DataType)
Initializes categorical converters for all categorical mappings present in this dtype.
Auto Trait Implementations§
impl Freeze for CategoricalToArrowConverter
impl RefUnwindSafe for CategoricalToArrowConverter
impl Send for CategoricalToArrowConverter
impl Sync for CategoricalToArrowConverter
impl Unpin for CategoricalToArrowConverter
impl UnwindSafe for CategoricalToArrowConverter
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
Mutably borrows from an owned value. Read more
§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> 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> ⓘ
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 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> ⓘ
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