Struct polars_core::chunked_array::ops::sort::options::SortMultipleOptions
source · pub struct SortMultipleOptions {
pub descending: Vec<bool>,
pub nulls_last: Vec<bool>,
pub multithreaded: bool,
pub maintain_order: bool,
}
Expand description
Sort options for multi-series sorting.
Indicating the order of sorting, nulls position, multithreading, and maintaining order.
§Example
let df = df! {
"a" => [Some(1), Some(2), None, Some(4), None],
"b" => [Some(5), None, Some(3), Some(2), Some(1)]
}?;
let out = df
.sort(
["a", "b"],
SortMultipleOptions::default()
.with_maintain_order(true)
.with_multithreaded(false)
.with_order_descending_multi([false, true])
.with_nulls_last(true),
)?;
let expected = df! {
"a" => [Some(1), Some(2), Some(4), None, None],
"b" => [Some(5), None, Some(2), Some(3), Some(1)]
}?;
assert_eq!(out, expected);
Fields§
§descending: Vec<bool>
Order of the columns. Default all `false``.
If only one value is given, it will broadcast to all columns.
Use SortMultipleOptions::with_order_descending_multi
or SortMultipleOptions::with_order_descending
to modify.
§Safety
Len must match the number of columns, or equal 1.
nulls_last: Vec<bool>
Whether place null values last. Default false
.
multithreaded: bool
Whether sort in multiple threads. Default true
.
maintain_order: bool
Whether maintain the order of equal elements. Default false
.
Implementations§
source§impl SortMultipleOptions
impl SortMultipleOptions
sourcepub fn with_order_descending_multi(
self,
descending: impl IntoIterator<Item = bool>
) -> Self
pub fn with_order_descending_multi( self, descending: impl IntoIterator<Item = bool> ) -> Self
Specify order for each column. Defaults all false
.
§Safety
Len must match the number of columns, or be equal to 1.
sourcepub fn with_order_descending(self, descending: bool) -> Self
pub fn with_order_descending(self, descending: bool) -> Self
Implement order for all columns. Default false
.
sourcepub fn with_nulls_last_multi(
self,
nulls_last: impl IntoIterator<Item = bool>
) -> Self
pub fn with_nulls_last_multi( self, nulls_last: impl IntoIterator<Item = bool> ) -> Self
Specify whether to place nulls last, per-column. Defaults all false
.
§Safety
Len must match the number of columns, or be equal to 1.
sourcepub fn with_nulls_last(self, enabled: bool) -> Self
pub fn with_nulls_last(self, enabled: bool) -> Self
Whether to place null values last. Default false
.
sourcepub fn with_multithreaded(self, enabled: bool) -> Self
pub fn with_multithreaded(self, enabled: bool) -> Self
Whether to sort in multiple threads. Default true
.
sourcepub fn with_maintain_order(self, enabled: bool) -> Self
pub fn with_maintain_order(self, enabled: bool) -> Self
Whether to maintain the order of equal elements. Default false
.
sourcepub fn with_order_reversed(self) -> Self
pub fn with_order_reversed(self) -> Self
Reverse the order of sorting for each column.
Trait Implementations§
source§impl Clone for SortMultipleOptions
impl Clone for SortMultipleOptions
source§fn clone(&self) -> SortMultipleOptions
fn clone(&self) -> SortMultipleOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SortMultipleOptions
impl Debug for SortMultipleOptions
source§impl Default for SortMultipleOptions
impl Default for SortMultipleOptions
source§impl From<&SortMultipleOptions> for SortOptions
impl From<&SortMultipleOptions> for SortOptions
source§fn from(value: &SortMultipleOptions) -> Self
fn from(value: &SortMultipleOptions) -> Self
source§impl From<&SortOptions> for SortMultipleOptions
impl From<&SortOptions> for SortMultipleOptions
source§fn from(value: &SortOptions) -> Self
fn from(value: &SortOptions) -> Self
source§impl Hash for SortMultipleOptions
impl Hash for SortMultipleOptions
source§impl PartialEq for SortMultipleOptions
impl PartialEq for SortMultipleOptions
source§fn eq(&self, other: &SortMultipleOptions) -> bool
fn eq(&self, other: &SortMultipleOptions) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for SortMultipleOptions
impl StructuralPartialEq for SortMultipleOptions
Auto Trait Implementations§
impl Freeze for SortMultipleOptions
impl RefUnwindSafe for SortMultipleOptions
impl Send for SortMultipleOptions
impl Sync for SortMultipleOptions
impl Unpin for SortMultipleOptions
impl UnwindSafe for SortMultipleOptions
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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