Struct polars_plan::dsl::ListNameSpace
source · pub struct ListNameSpace(pub Expr);
Expand description
Specialized expressions for Series
of DataType::List
.
Tuple Fields§
§0: Expr
Implementations§
source§impl ListNameSpace
impl ListNameSpace
sourcepub fn mean(self) -> Expr
pub fn mean(self) -> Expr
Compute the mean of every sublist and return a Series
of dtype Float64
sourcepub fn sort(self, options: SortOptions) -> Expr
pub fn sort(self, options: SortOptions) -> Expr
Sort every sublist.
sourcepub fn join(self, separator: &str) -> Expr
pub fn join(self, separator: &str) -> Expr
Join all string items in a sublist and place a separator between them.
Error
This errors if inner type of list != DataType::Utf8
.
sourcepub fn diff(self, n: usize, null_behavior: NullBehavior) -> Expr
Available on crate feature diff
only.
pub fn diff(self, n: usize, null_behavior: NullBehavior) -> Expr
diff
only.Diff every sublist.
sourcepub fn to_struct(
self,
n_fields: ListToStructWidthStrategy,
name_generator: Option<NameGenerator>,
upper_bound: usize
) -> Expr
Available on crate feature list_to_struct
only.
pub fn to_struct(
self,
n_fields: ListToStructWidthStrategy,
name_generator: Option<NameGenerator>,
upper_bound: usize
) -> Expr
list_to_struct
only.Convert this List
to a Series
of type Struct
. The width will be determined according to
ListToStructWidthStrategy
and the names of the fields determined by the given name_generator
.
Schema
A polars [LazyFrame
] needs to know the schema at all time. The caller therefore must provide
an upper_bound
of struct fields that will be set.
If this is incorrectly downstream operation may fail. For instance an all().sum()
expression
will look in the current schema to determine which columns to select.