Struct polars_arrow::array::MutableDictionaryArray
source · pub struct MutableDictionaryArray<K: DictionaryKey, M: MutableArray> { /* private fields */ }
Implementations§
source§impl<K: DictionaryKey, M: MutableArray + Default> MutableDictionaryArray<K, M>
impl<K: DictionaryKey, M: MutableArray + Default> MutableDictionaryArray<K, M>
sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty MutableDictionaryArray
.
source§impl<K: DictionaryKey, M: MutableArray> MutableDictionaryArray<K, M>
impl<K: DictionaryKey, M: MutableArray> MutableDictionaryArray<K, M>
sourcepub fn try_empty(values: M) -> PolarsResult<Self>
pub fn try_empty(values: M) -> PolarsResult<Self>
Creates an empty MutableDictionaryArray
from a given empty values array.
§Errors
Errors if the array is non-empty.
sourcepub fn from_values(values: M) -> PolarsResult<Self>
pub fn from_values(values: M) -> PolarsResult<Self>
Creates an empty MutableDictionaryArray
preloaded with a given dictionary of values.
Indices associated with those values are automatically assigned based on the order of
the values.
§Errors
Errors if there’s more values than the maximum value of K
or if values are not unique.
sourcepub fn into_empty(self) -> Self
pub fn into_empty(self) -> Self
Creates an empty MutableDictionaryArray
retaining the same dictionary as the current
mutable dictionary array, but with no data. This may come useful when serializing the
array into multiple chunks, where there’s a requirement that the dictionary is the same.
No copying is performed, the value map is moved over to the new array.
sourcepub fn to_empty(&self) -> Selfwhere
M: Clone,
pub fn to_empty(&self) -> Selfwhere
M: Clone,
Same as into_empty
but clones the inner value map instead of taking full ownership.
sourcepub fn into_arc(self) -> Arc<dyn Array>
pub fn into_arc(self) -> Arc<dyn Array>
converts itself into Arc<dyn Array>
sourcepub fn into_box(self) -> Box<dyn Array>
pub fn into_box(self) -> Box<dyn Array>
converts itself into Box<dyn Array>
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the MutableDictionaryArray
to fit its current length.
sourcepub fn keys(&self) -> &MutablePrimitiveArray<K>
pub fn keys(&self) -> &MutablePrimitiveArray<K>
Returns the dictionary keys
Trait Implementations§
source§impl<K: Debug + DictionaryKey, M: Debug + MutableArray> Debug for MutableDictionaryArray<K, M>
impl<K: Debug + DictionaryKey, M: Debug + MutableArray> Debug for MutableDictionaryArray<K, M>
source§impl<K: DictionaryKey, M: MutableArray + Default> Default for MutableDictionaryArray<K, M>
impl<K: DictionaryKey, M: MutableArray + Default> Default for MutableDictionaryArray<K, M>
source§impl<K: DictionaryKey, M: MutableArray> From<MutableDictionaryArray<K, M>> for DictionaryArray<K>
impl<K: DictionaryKey, M: MutableArray> From<MutableDictionaryArray<K, M>> for DictionaryArray<K>
source§fn from(other: MutableDictionaryArray<K, M>) -> Self
fn from(other: MutableDictionaryArray<K, M>) -> Self
source§impl<K: DictionaryKey, M: 'static + MutableArray> MutableArray for MutableDictionaryArray<K, M>
impl<K: DictionaryKey, M: 'static + MutableArray> MutableArray for MutableDictionaryArray<K, M>
source§fn validity(&self) -> Option<&MutableBitmap>
fn validity(&self) -> Option<&MutableBitmap>
source§fn as_arc(&mut self) -> Arc<dyn Array>
fn as_arc(&mut self) -> Arc<dyn Array>
Array
.source§fn data_type(&self) -> &ArrowDataType
fn data_type(&self) -> &ArrowDataType
ArrowDataType
of the array.source§fn as_mut_any(&mut self) -> &mut dyn Any
fn as_mut_any(&mut self) -> &mut dyn Any
Any
, to enable dynamic casting.source§fn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
source§impl<K, M, T> TryExtend<Option<T>> for MutableDictionaryArray<K, M>where
K: DictionaryKey,
M: MutableArray + Indexable + TryExtend<Option<T>> + TryPush<Option<T>>,
T: AsIndexed<M>,
M::Type: Eq + Hash,
impl<K, M, T> TryExtend<Option<T>> for MutableDictionaryArray<K, M>where
K: DictionaryKey,
M: MutableArray + Indexable + TryExtend<Option<T>> + TryPush<Option<T>>,
T: AsIndexed<M>,
M::Type: Eq + Hash,
source§fn try_extend<II: IntoIterator<Item = Option<T>>>(
&mut self,
iter: II,
) -> PolarsResult<()>
fn try_extend<II: IntoIterator<Item = Option<T>>>( &mut self, iter: II, ) -> PolarsResult<()>
Extend::extend
.source§impl<K, M, T> TryPush<Option<T>> for MutableDictionaryArray<K, M>where
K: DictionaryKey,
M: MutableArray + Indexable + TryPush<Option<T>>,
T: AsIndexed<M>,
M::Type: Eq + Hash,
impl<K, M, T> TryPush<Option<T>> for MutableDictionaryArray<K, M>where
K: DictionaryKey,
M: MutableArray + Indexable + TryPush<Option<T>>,
T: AsIndexed<M>,
M::Type: Eq + Hash,
Auto Trait Implementations§
impl<K, M> Freeze for MutableDictionaryArray<K, M>where
M: Freeze,
impl<K, M> RefUnwindSafe for MutableDictionaryArray<K, M>where
M: RefUnwindSafe,
impl<K, M> Send for MutableDictionaryArray<K, M>
impl<K, M> Sync for MutableDictionaryArray<K, M>
impl<K, M> Unpin for MutableDictionaryArray<K, M>
impl<K, M> UnwindSafe for MutableDictionaryArray<K, M>where
M: UnwindSafe,
K: UnwindSafe,
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