Enum polars::prelude::Expr [−][src]
Queries consists of multiple expressions.
Variants
Literal(ScalarValue)
Agg(AggExpr)
Fields of Udf
See postgres window functions
Fields of Window
Fields of Slice
Fields of BinaryFunction
input_a: Box<Expr, Global>
input_b: Box<Expr, Global>
function: Arc<dyn SeriesBinaryUdf + 'static>
output_field: Arc<dyn BinaryUdfOutputField + 'static>
Delays output type evaluation until input schema is known.
Implementations
impl Expr
[src]
pub fn get_type(
&self,
schema: &Schema,
context: Context
) -> Result<DataType, PolarsError>
[src]
&self,
schema: &Schema,
context: Context
) -> Result<DataType, PolarsError>
Get DataType result of the expression. The schema is the input data.
impl Expr
[src]
pub fn eq(self, other: Expr) -> Expr
[src]
Compare Expr
with other Expr
on equality
pub fn neq(self, other: Expr) -> Expr
[src]
Compare Expr
with other Expr
on non-equality
pub fn lt(self, other: Expr) -> Expr
[src]
Check if Expr
< Expr
pub fn gt(self, other: Expr) -> Expr
[src]
Check if Expr
> Expr
pub fn gt_eq(self, other: Expr) -> Expr
[src]
Check if Expr
>= Expr
pub fn lt_eq(self, other: Expr) -> Expr
[src]
Check if Expr
<= Expr
pub fn not(self) -> Expr
[src]
Negate Expr
pub fn alias(self, name: &str) -> Expr
[src]
Rename Column.
pub fn is_null(self) -> Expr
[src]
Run is_null operation on Expr
.
pub fn is_not_null(self) -> Expr
[src]
Run is_not_null operation on Expr
.
pub fn min(self) -> Expr
[src]
Reduce groups to minimal value.
pub fn max(self) -> Expr
[src]
Reduce groups to maximum value.
pub fn mean(self) -> Expr
[src]
Reduce groups to the mean value.
pub fn median(self) -> Expr
[src]
Reduce groups to the median value.
pub fn sum(self) -> Expr
[src]
Reduce groups to the sum of all the values.
pub fn n_unique(self) -> Expr
[src]
Get the number of unique values in the groups.
pub fn first(self) -> Expr
[src]
Get the first value in the group.
pub fn last(self) -> Expr
[src]
Get the last value in the group.
pub fn list(self) -> Expr
[src]
Aggregate the group to a Series
pub fn quantile(self, quantile: f64) -> Expr
[src]
Compute the quantile per group.
pub fn agg_groups(self) -> Expr
[src]
Get the group indexes of the group by operation.
pub fn explode(self) -> Expr
[src]
Explode the utf8/ list column
pub fn slice(self, offset: isize, length: usize) -> Expr
[src]
Slice the Series.
pub fn head(self, length: Option<usize>) -> Expr
[src]
Get the first n
elements of the Expr result
pub fn tail(self, length: Option<usize>) -> Expr
[src]
Get the last n
elements of the Expr result
pub fn cast(self, data_type: DataType) -> Expr
[src]
Cast expression to another data type.
pub fn sort(self, reverse: bool) -> Expr
[src]
Sort expression. See the eager implementation.
pub fn reverse(self) -> Expr
[src]
Reverse column
pub fn map<F>(self, function: F, output_type: Option<DataType>) -> Expr where
F: SeriesUdf + 'static,
[src]
F: SeriesUdf + 'static,
Apply a function/closure once the logical plan get executed. It is the responsibility of the caller that the schema is correct by giving the correct output_type. If None given the output type of the input expr is used.
pub fn is_finite(self) -> Expr
[src]
Get mask of finite values if dtype is Float
pub fn is_infinite(self) -> Expr
[src]
Get mask of infinite values if dtype is Float
pub fn is_nan(self) -> Expr
[src]
Get mask of NaN values if dtype is Float
pub fn is_not_nan(self) -> Expr
[src]
Get inverse mask of NaN values if dtype is Float
pub fn shift(self, periods: i32) -> Expr
[src]
Shift the values in the array by some period. See the eager implementation.
pub fn cum_sum(self, reverse: bool) -> Expr
[src]
Get an array with the cumulative sum computed at every element
pub fn cum_min(self, reverse: bool) -> Expr
[src]
Get an array with the cumulative min computed at every element
pub fn cum_max(self, reverse: bool) -> Expr
[src]
Get an array with the cumulative max computed at every element
pub fn over(self, partition_by: Expr) -> Expr
[src]
Apply window function over a subgroup. This is similar to a groupby + aggregation + self join. Or similar to window functions in Postgres.
Example
#[macro_use] extern crate polars_core; use polars_core::prelude::*; use polars_lazy::prelude::*; fn example() -> Result<()> { let df = df! { "groups" => &[1, 1, 2, 2, 1, 2, 3, 3, 1], "values" => &[1, 2, 3, 4, 5, 6, 7, 8, 8] }?; let out = df .lazy() .select(&[ col("groups"), sum("values").over(col("groups")), ]) .collect()?; dbg!(&out); Ok(()) }
Outputs:
╭────────┬────────╮
│ groups ┆ values │
│ --- ┆ --- │
│ i32 ┆ i32 │
╞════════╪════════╡
│ 1 ┆ 16 │
├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
│ 1 ┆ 16 │
├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
│ 2 ┆ 13 │
├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
│ 2 ┆ 13 │
├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
│ ... ┆ ... │
├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
│ 1 ┆ 16 │
├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
│ 2 ┆ 13 │
├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
│ 3 ┆ 15 │
├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
│ 3 ┆ 15 │
├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
│ 1 ┆ 16 │
╰────────┴────────╯
pub fn fill_none(self, fill_value: Expr) -> Expr
[src]
Shift the values in the array by some period. See the eager implementation.
pub fn count(self) -> Expr
[src]
Count the values of the Series or Get counts of the group by operation.
pub fn std(self) -> Expr
[src]
Standard deviation of the values of the Series
pub fn var(self) -> Expr
[src]
Variance of the values of the Series
pub fn is_duplicated(self) -> Expr
[src]
Get a mask of duplicated values
pub fn is_unique(self) -> Expr
[src]
Get a mask of unique values
pub fn and(self, expr: Expr) -> Expr
[src]
and operation
pub fn or(self, expr: Expr) -> Expr
[src]
or operation
pub fn pow(self, exponent: f64) -> Expr
[src]
Raise expression to the power exponent
pub fn year(self) -> Expr
[src]
Get the year of a Date32/Date64
pub fn month(self) -> Expr
[src]
Get the month of a Date32/Date64
pub fn day(self) -> Expr
[src]
Get the month of a Date32/Date64
pub fn ordinal_day(self) -> Expr
[src]
Get the ordinal_day of a Date32/Date64
pub fn hour(self) -> Expr
[src]
Get the hour of a Date64/Time64
pub fn minute(self) -> Expr
[src]
Get the minute of a Date64/Time64
pub fn second(self) -> Expr
[src]
Get the second of a Date64/Time64
pub fn nanosecond(self) -> Expr
[src]
Get the nanosecond of a Time64
Trait Implementations
impl Add<Expr> for Expr
[src]
type Output = Expr
The resulting type after applying the +
operator.
pub fn add(self, rhs: Expr) -> <Expr as Add<Expr>>::Output
[src]
impl AsRef<Expr> for AggExpr
[src]
impl Clone for Expr
[src]
impl Debug for Expr
[src]
impl Div<Expr> for Expr
[src]
type Output = Expr
The resulting type after applying the /
operator.
pub fn div(self, rhs: Expr) -> <Expr as Div<Expr>>::Output
[src]
impl From<AggExpr> for Expr
[src]
impl Mul<Expr> for Expr
[src]
type Output = Expr
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Expr) -> <Expr as Mul<Expr>>::Output
[src]
impl PartialEq<Expr> for Expr
[src]
pub fn eq(&self, other: &Expr) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl Rem<Expr> for Expr
[src]
type Output = Expr
The resulting type after applying the %
operator.
pub fn rem(self, rhs: Expr) -> <Expr as Rem<Expr>>::Output
[src]
impl Sub<Expr> for Expr
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Expr
[src]
impl Send for Expr
[src]
impl Sync for Expr
[src]
impl Unpin for Expr
[src]
impl !UnwindSafe for Expr
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> Cast<U> for T where
U: FromCast<T>,
U: FromCast<T>,
pub fn cast(self) -> U
impl<T> From<T> for T
[src]
impl<T> FromCast<T> for T
pub fn from_cast(t: T) -> T
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
[src]
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,