LazyFrame
struct LazyFrame
[src]
pub fn csv(paths: string | [string], has_header: bool = false): LazyFrame throws PolarsError {
switch (let paths = paths.(type)) {
case string:
return try LazyFrame._csv([paths], has_header);
case [string]:
return try LazyFrame._csv(paths, has_header);
}
}
Create a LazyFrame from CSV files.
[src]
pub fn csv(paths: string | [string], has_header: bool = false): LazyFrame throws PolarsError {
switch (let paths = paths.(type)) {
case string:
return try LazyFrame._csv([paths], has_header);
case [string]:
return try LazyFrame._csv(paths, has_header);
}
}
Create a LazyFrame from CSV files.
Create a LazyFrame from CSV files.
parquet
pub fn parquet(paths: string | [string]): LazyFrame throws PolarsError
[src]
pub fn parquet(paths: string | [string]): LazyFrame throws PolarsError {
switch (let paths = paths.(type)) {
case string:
return try LazyFrame._parquet([paths]);
case [string]:
return try LazyFrame._parquet(paths);
}
}
Create a LazyFrame from Parquet files.
parquet
pub fn parquet(paths: string | [string]): LazyFrame throws PolarsError
[src]
pub fn parquet(paths: string | [string]): LazyFrame throws PolarsError {
switch (let paths = paths.(type)) {
case string:
return try LazyFrame._parquet([paths]);
case [string]:
return try LazyFrame._parquet(paths);
}
}
Create a LazyFrame from Parquet files.
Create a LazyFrame from Parquet files.
bottom_k
pub fn bottom_k(self, k: int, by_exprs: [Expr], descending: [bool] = [false], nulls_last: [bool] = [false], multithreaded: bool = true, maintain_order: bool = false, limit: int? = nil): LazyFrame
[src]
pub fn bottom_k(
self,
k: int,
by_exprs: [Expr],
descending: [bool] = [false],
nulls_last: [bool] = [false],
multithreaded: bool = true,
maintain_order: bool = false,
limit: int? = nil
): LazyFrame {
return self
._bottom_k(k, by_exprs, descending, nulls_last, multithreaded, maintain_order, limit);
}
bottom_k
pub fn bottom_k(self, k: int, by_exprs: [Expr], descending: [bool] = [false], nulls_last: [bool] = [false], multithreaded: bool = true, maintain_order: bool = false, limit: int? = nil): LazyFrame
[src]
pub fn bottom_k(
self,
k: int,
by_exprs: [Expr],
descending: [bool] = [false],
nulls_last: [bool] = [false],
multithreaded: bool = true,
maintain_order: bool = false,
limit: int? = nil
): LazyFrame {
return self
._bottom_k(k, by_exprs, descending, nulls_last, multithreaded, maintain_order, limit);
}
Caches the result into a new LazyFrame.
Caches the result into a new LazyFrame.
Caches the result into a new LazyFrame.
This should be used to prevent computations running multiple times.
Cast named frame columns, resulting in a new LazyFrame with updated dtypes
Cast named frame columns, resulting in a new LazyFrame with updated dtypes
Cast named frame columns, resulting in a new LazyFrame with updated dtypes
Cast all frame columns to the given dtype, resulting in a new LazyFrame
Cast all frame columns to the given dtype, resulting in a new LazyFrame
Cast all frame columns to the given dtype, resulting in a new LazyFrame
collect
pub fn collect(self): DataFrame throws PolarsError
Execute all the lazy operations and collect them into a DataFrame.
collect
pub fn collect(self): DataFrame throws PolarsError
Execute all the lazy operations and collect them into a DataFrame.
Execute all the lazy operations and collect them into a DataFrame.
column
pub fn column(self, expr: Expr): LazyFrame throws PolarsError
Add or replace a column, given as an expression, to a DataFrame.
column
pub fn column(self, expr: Expr): LazyFrame throws PolarsError
Add or replace a column, given as an expression, to a DataFrame.
Add or replace a column, given as an expression, to a DataFrame.
Return the number of non-null elements for each column.
Return the number of non-null elements for each column.
Return the number of non-null elements for each column.
drop_nans
pub fn drop_nans(self, subset: [Expr]? = nil): LazyFrame throws PolarsError
Drop rows containing one or more NaN values.
drop_nans
pub fn drop_nans(self, subset: [Expr]? = nil): LazyFrame throws PolarsError
Drop rows containing one or more NaN values.
Drop rows containing one or more NaN values.
drop_nulls
pub fn drop_nulls(self, subset: [Expr]? = nil): LazyFrame throws PolarsError
Drop rows containing one or more None values.
drop_nulls
pub fn drop_nulls(self, subset: [Expr]? = nil): LazyFrame throws PolarsError
Drop rows containing one or more None values.
Drop rows containing one or more None values.
Apply explode operation.
Apply explode operation.
Apply explode operation.
group_by
pub fn group_by(self, by: [Expr], stable: bool = false): LazyGroupBy
Performs a “group-by” on a LazyFrame, producing a LazyGroupBy, which can subsequently be aggregated.
group_by
pub fn group_by(self, by: [Expr], stable: bool = false): LazyGroupBy
Performs a “group-by” on a LazyFrame, producing a LazyGroupBy, which can subsequently be aggregated.
Performs a “group-by” on a LazyFrame, producing a LazyGroupBy, which can subsequently be aggregated.
group_by_dynamic
pub fn group_by_dynamic(self, index_column: Expr, by: [Expr], every: Duration = Duration.new(1), period: Duration = Duration.new(1), offset: Duration = Duration.new(1), label: Label = .Left, include_boundaries: bool = false, closed_window: ClosedWindow = .Left, start_by: StartBy = .WindowBound): LazyGroupBy
[src]
pub fn group_by_dynamic(
self,
index_column: Expr,
by: [Expr],
every: Duration = Duration.new(1),
period: Duration = Duration.new(1),
offset: Duration = Duration.new(1),
label: Label = .Left,
include_boundaries: bool = false,
closed_window: ClosedWindow = .Left,
start_by: StartBy = .WindowBound
): LazyGroupBy {
return self
._group_by_dynamic(
index_column,
by,
every,
period,
offset,
label as int,
include_boundaries,
closed_window as int,
start_by as int
);
}
Group based on a time value (or index value of type Int32, Int64).
group_by_dynamic
pub fn group_by_dynamic(self, index_column: Expr, by: [Expr], every: Duration = Duration.new(1), period: Duration = Duration.new(1), offset: Duration = Duration.new(1), label: Label = .Left, include_boundaries: bool = false, closed_window: ClosedWindow = .Left, start_by: StartBy = .WindowBound): LazyGroupBy
[src]
pub fn group_by_dynamic(
self,
index_column: Expr,
by: [Expr],
every: Duration = Duration.new(1),
period: Duration = Duration.new(1),
offset: Duration = Duration.new(1),
label: Label = .Left,
include_boundaries: bool = false,
closed_window: ClosedWindow = .Left,
start_by: StartBy = .WindowBound
): LazyGroupBy {
return self
._group_by_dynamic(
index_column,
by,
every,
period,
offset,
label as int,
include_boundaries,
closed_window as int,
start_by as int
);
}
Group based on a time value (or index value of type Int32, Int64).
Group based on a time value (or index value of type Int32, Int64).
Time windows are calculated and rows are assigned to windows. Different from a normal group_by is that a row can be member of multiple groups. The time/index window could be seen as a rolling window, with a window size determined by dates/times/values instead of slots in the DataFrame.
A window is defined by: - every: interval of the window - period: length of the window - offset: offset of the window
The group_by argument should be empty []
if you don’t want to combine this with a ordinary group_by on these keys.
join
pub fn join(self, other: LazyFrame, left_on: [Expr], right_on: [Expr], how: JoinType = .Inner, validation: JoinValidation = .ManyToMany, maintain_order: MaintainOrderJoin = .None, suffix: string? = nil, offset: int? = nil, length: int? = nil, join_nulls: bool = false, join_coalesce: JoinCoalesce = .JoinSpecific): LazyFrame
[src]
pub fn join(
self,
other: LazyFrame,
left_on: [Expr],
right_on: [Expr],
how: JoinType = .Inner,
validation: JoinValidation = .ManyToMany,
maintain_order: MaintainOrderJoin = .None,
suffix: string? = nil,
offset: int? = nil,
length: int? = nil,
join_nulls: bool = false,
join_coalesce: JoinCoalesce = .JoinSpecific
): LazyFrame {
return self
._join(
other,
left_on,
right_on,
how as int,
validation as int,
maintain_order as int,
suffix,
offset,
length,
join_nulls,
join_coalesce as int
);
}
Generic function to join two LazyFrames.
join
pub fn join(self, other: LazyFrame, left_on: [Expr], right_on: [Expr], how: JoinType = .Inner, validation: JoinValidation = .ManyToMany, maintain_order: MaintainOrderJoin = .None, suffix: string? = nil, offset: int? = nil, length: int? = nil, join_nulls: bool = false, join_coalesce: JoinCoalesce = .JoinSpecific): LazyFrame
[src]
pub fn join(
self,
other: LazyFrame,
left_on: [Expr],
right_on: [Expr],
how: JoinType = .Inner,
validation: JoinValidation = .ManyToMany,
maintain_order: MaintainOrderJoin = .None,
suffix: string? = nil,
offset: int? = nil,
length: int? = nil,
join_nulls: bool = false,
join_coalesce: JoinCoalesce = .JoinSpecific
): LazyFrame {
return self
._join(
other,
left_on,
right_on,
how as int,
validation as int,
maintain_order as int,
suffix,
offset,
length,
join_nulls,
join_coalesce as int
);
}
Generic function to join two LazyFrames.
Generic function to join two LazyFrames.
Limit the DataFrame to the first n
rows.
Limit the DataFrame to the first n
rows.
Limit the DataFrame to the first n
rows.
Aggregate all the columns as their maximum values.
Aggregate all the columns as their maximum values.
Aggregate all the columns as their maximum values.
Aggregated columns will have the same names as the original columns.
Aggregate all the columns as their mean values.
Aggregate all the columns as their mean values.
Aggregate all the columns as their mean values.
- Boolean and integer columns are converted to f64 before computing the mean.
- String columns will have a mean of None.
Aggregate all the columns as their median values.
Aggregate all the columns as their median values.
Aggregate all the columns as their median values.
- Boolean and integer results are converted to
f64
. However, they are still susceptible to overflow before this conversion occurs. - String columns will sum to None.
Aggregate all the columns as their minimum values.
Aggregate all the columns as their minimum values.
Aggregate all the columns as their minimum values.
Aggregated columns will have the same names as the original columns.
null_count
pub fn null_count(self): LazyFrame
Aggregate all the columns as the sum of their null value count.
null_count
pub fn null_count(self): LazyFrame
Aggregate all the columns as the sum of their null value count.
Aggregate all the columns as the sum of their null value count.
options
pub fn options(self, projection_pushdown: bool = true, predicate_pushdown: bool = true, with_slice_pushdown: bool = true, with_type_coercion: bool = true, check_order: bool = true, cluster_with_columns: bool = true, collapse_joins: bool = true, simplify_expr: bool = true, comm_subplan_elim: bool = true, comm_subexpr_elim: bool = true, streaming: bool = true, row_estimate: bool = true): LazyFrame
Set options for the LazyFrame.
options
pub fn options(self, projection_pushdown: bool = true, predicate_pushdown: bool = true, with_slice_pushdown: bool = true, with_type_coercion: bool = true, check_order: bool = true, cluster_with_columns: bool = true, collapse_joins: bool = true, simplify_expr: bool = true, comm_subplan_elim: bool = true, comm_subexpr_elim: bool = true, streaming: bool = true, row_estimate: bool = true): LazyFrame
Set options for the LazyFrame.
Set options for the LazyFrame.
Arguments
projection_pushdown
: Toggle projection pushdown optimization.predicate_pushdown
: Toggle predicate pushdown optimization.with_slice_pushdown
: Toggle slice pushdown optimization.with_type_coercion
: Toggle type coercion optimization.check_order
: Check if operations are order dependent and unset maintaining_order if the order would not be observed.cluster_with_columns
: Toggle cluster with columns optimization.collapse_joins
: Toggle collapse joins optimization.simplify_expr
: Toggle expression simplification optimization on or off.comm_subplan_elim
: Toggle common subplan elimination optimization on or off.comm_subexpr_elim
: Toggle common subexpression elimination optimization on or off.streaming
: Run nodes that are capably of doing so on the streaming engine.row_estimate
: Try to estimate the number of rows so that joins can determine which side to keep in memory.
quantile
pub fn quantile(self, quantile: Expr, method: QuantileMethod): LazyFrame
[src]
pub fn quantile(self, quantile: Expr, method: QuantileMethod): LazyFrame {
return self._quantile(quantile, method as int);
}
Aggregate all the columns as their quantile values.
quantile
pub fn quantile(self, quantile: Expr, method: QuantileMethod): LazyFrame
[src]
pub fn quantile(self, quantile: Expr, method: QuantileMethod): LazyFrame {
return self._quantile(quantile, method as int);
}
Aggregate all the columns as their quantile values.
Aggregate all the columns as their quantile values.
Select (and optionally rename, with alias) columns from the query.
Select (and optionally rename, with alias) columns from the query.
Select (and optionally rename, with alias) columns from the query.
Columns can be selected with Expr.col
, If you want to select all columns use Expr.all
.
sink_csv
pub fn sink_csv(self, path: string, include_bom: bool = false, include_header: bool = true, maintain_order: bool = false) throws PolarsError
Stream a query result into an csv file.
sink_csv
pub fn sink_csv(self, path: string, include_bom: bool = false, include_header: bool = true, maintain_order: bool = false) throws PolarsError
Stream a query result into an csv file.
Stream a query result into an csv file.
This is useful if the final result doesn’t fit into memory. This methods will throw an error if the query cannot be completely done in a streaming fashion.
sink_parquet
pub fn sink_parquet(self, path: string, maintain_order: bool = false) throws PolarsError
sink_parquet
pub fn sink_parquet(self, path: string, maintain_order: bool = false) throws PolarsError
Slice the DataFrame using an offset (starting row) and a length.
Slice the DataFrame using an offset (starting row) and a length.
Slice the DataFrame using an offset (starting row) and a length.
sort
pub fn sort(self, by: [string], descending: [bool] = [false], nulls_last: [bool] = [false], multithreaded: bool = true, maintain_order: bool = false, limit: int? = nil): LazyFrame
[src]
pub fn sort(
self,
by: [string],
descending: [bool] = [false],
nulls_last: [bool] = [false],
multithreaded: bool = true,
maintain_order: bool = false,
limit: int? = nil
): LazyFrame {
return self._sort(by, descending, nulls_last, multithreaded, maintain_order, limit);
}
Add a sort operation to the logical plan.
sort
pub fn sort(self, by: [string], descending: [bool] = [false], nulls_last: [bool] = [false], multithreaded: bool = true, maintain_order: bool = false, limit: int? = nil): LazyFrame
[src]
pub fn sort(
self,
by: [string],
descending: [bool] = [false],
nulls_last: [bool] = [false],
multithreaded: bool = true,
maintain_order: bool = false,
limit: int? = nil
): LazyFrame {
return self._sort(by, descending, nulls_last, multithreaded, maintain_order, limit);
}
Add a sort operation to the logical plan.
Add a sort operation to the logical plan.
sort_by_exprs
pub fn sort_by_exprs(self, by: [Expr], descending: [bool] = [false], nulls_last: [bool] = [false], multithreaded: bool = true, maintain_order: bool = false, limit: int? = nil): LazyFrame
[src]
pub fn sort_by_exprs(
self,
by: [Expr],
descending: [bool] = [false],
nulls_last: [bool] = [false],
multithreaded: bool = true,
maintain_order: bool = false,
limit: int? = nil
): LazyFrame {
return self._sort_by_exprs(by, descending, nulls_last, multithreaded, maintain_order, limit);
}
Add a sort operation to the logical plan.
sort_by_exprs
pub fn sort_by_exprs(self, by: [Expr], descending: [bool] = [false], nulls_last: [bool] = [false], multithreaded: bool = true, maintain_order: bool = false, limit: int? = nil): LazyFrame
[src]
pub fn sort_by_exprs(
self,
by: [Expr],
descending: [bool] = [false],
nulls_last: [bool] = [false],
multithreaded: bool = true,
maintain_order: bool = false,
limit: int? = nil
): LazyFrame {
return self._sort_by_exprs(by, descending, nulls_last, multithreaded, maintain_order, limit);
}
Add a sort operation to the logical plan.
Add a sort operation to the logical plan.
sql
pub fn sql(self, query: string, table_name: string = "self"): DataFrame throws PolarsError
Execute a SQL query against the LazyFrame.
sql
pub fn sql(self, query: string, table_name: string = "self"): DataFrame throws PolarsError
Execute a SQL query against the LazyFrame.
Execute a SQL query against the LazyFrame.
Aggregate all the columns as their variance values.
Aggregate all the columns as their variance values.
Aggregate all the columns as their variance values.
Aggregate all the columns as their minimum values.
Aggregate all the columns as their minimum values.
Aggregate all the columns as their minimum values.
Aggregated columns will have the same names as the original columns.
top_k
pub fn top_k(self, k: int, by_exprs: [Expr], descending: [bool] = [false], nulls_last: [bool] = [false], multithreaded: bool = true, maintain_order: bool = false, limit: int? = nil): LazyFrame
[src]
pub fn top_k(
self,
k: int,
by_exprs: [Expr],
descending: [bool] = [false],
nulls_last: [bool] = [false],
multithreaded: bool = true,
maintain_order: bool = false,
limit: int? = nil
): LazyFrame {
return self._top_k(k, by_exprs, descending, nulls_last, multithreaded, maintain_order, limit);
}
top_k
pub fn top_k(self, k: int, by_exprs: [Expr], descending: [bool] = [false], nulls_last: [bool] = [false], multithreaded: bool = true, maintain_order: bool = false, limit: int? = nil): LazyFrame
[src]
pub fn top_k(
self,
k: int,
by_exprs: [Expr],
descending: [bool] = [false],
nulls_last: [bool] = [false],
multithreaded: bool = true,
maintain_order: bool = false,
limit: int? = nil
): LazyFrame {
return self._top_k(k, by_exprs, descending, nulls_last, multithreaded, maintain_order, limit);
}
unique
pub fn unique(self, subset: [string]? = nil, keep: UniqueKeepStrategy = .Any, stable: bool = false): LazyFrame
[src]
pub fn unique(
self, subset: [string]? = nil, keep: UniqueKeepStrategy = .Any, stable: bool = false
): LazyFrame {
return self._unique(subset, keep as int, stable);
}
Drop non-unique rows without maintaining the order of kept rows.
unique
pub fn unique(self, subset: [string]? = nil, keep: UniqueKeepStrategy = .Any, stable: bool = false): LazyFrame
[src]
pub fn unique(
self, subset: [string]? = nil, keep: UniqueKeepStrategy = .Any, stable: bool = false
): LazyFrame {
return self._unique(subset, keep as int, stable);
}
Drop non-unique rows without maintaining the order of kept rows.
Drop non-unique rows without maintaining the order of kept rows.