pub struct DataFrame(/* private fields */);Expand description
Root-owned DataFrame; delegates to the Polars backend.
Implementations§
Source§impl DataFrame
impl DataFrame
Sourcepub fn from_polars(df: PlDataFrame) -> Self
pub fn from_polars(df: PlDataFrame) -> Self
Create from a Polars DataFrame (via backend).
Sourcepub fn from_polars_with_options(df: PlDataFrame, case_sensitive: bool) -> Self
pub fn from_polars_with_options(df: PlDataFrame, case_sensitive: bool) -> Self
Create from a Polars DataFrame with options.
Sourcepub fn from_lazy_with_options(lf: LazyFrame, case_sensitive: bool) -> Self
pub fn from_lazy_with_options(lf: LazyFrame, case_sensitive: bool) -> Self
Create from a LazyFrame with options.
Sourcepub fn filter_expr_ir(
&self,
condition: &ExprIr,
) -> Result<DataFrame, EngineError>
pub fn filter_expr_ir( &self, condition: &ExprIr, ) -> Result<DataFrame, EngineError>
Filter rows using an engine-agnostic expression (ExprIr).
Sourcepub fn select_expr_ir(&self, exprs: &[ExprIr]) -> Result<DataFrame, EngineError>
pub fn select_expr_ir(&self, exprs: &[ExprIr]) -> Result<DataFrame, EngineError>
Select columns/expressions using ExprIr.
Sourcepub fn with_column_expr_ir(
&self,
name: &str,
expr: &ExprIr,
) -> Result<DataFrame, EngineError>
pub fn with_column_expr_ir( &self, name: &str, expr: &ExprIr, ) -> Result<DataFrame, EngineError>
Add or replace a column using ExprIr.
Sourcepub fn collect_rows(&self) -> Result<CollectedRows, EngineError>
pub fn collect_rows(&self) -> Result<CollectedRows, EngineError>
Collect as engine-agnostic rows (column name -> JSON value per row).
pub fn resolve_expr_column_names(&self, expr: Expr) -> Result<Expr, PolarsError>
pub fn coerce_string_numeric_comparisons( &self, expr: Expr, ) -> Result<Expr, PolarsError>
pub fn resolve_column_name(&self, name: &str) -> Result<String, PolarsError>
pub fn schema(&self) -> Result<StructType, PolarsError>
pub fn schema_engine(&self) -> Result<StructType, EngineError>
pub fn get_column_dtype(&self, name: &str) -> Option<PlDataType>
pub fn get_column_data_type(&self, name: &str) -> Option<DataType>
pub fn columns(&self) -> Result<Vec<String>, PolarsError>
pub fn columns_engine(&self) -> Result<Vec<String>, EngineError>
pub fn count(&self) -> Result<usize, PolarsError>
pub fn count_engine(&self) -> Result<usize, EngineError>
pub fn show(&self, n: Option<usize>) -> Result<(), PolarsError>
pub fn collect(&self) -> Result<Arc<PlDataFrame>, PolarsError>
pub fn collect_as_json_rows_engine( &self, ) -> Result<Vec<HashMap<String, JsonValue>>, EngineError>
pub fn collect_as_json_rows( &self, ) -> Result<Vec<HashMap<String, JsonValue>>, PolarsError>
pub fn to_json_rows(&self) -> Result<String, EngineError>
pub fn select_exprs(&self, exprs: Vec<Expr>) -> Result<DataFrame, PolarsError>
pub fn select(&self, cols: Vec<&str>) -> Result<DataFrame, PolarsError>
pub fn select_engine(&self, cols: Vec<&str>) -> Result<DataFrame, EngineError>
pub fn select_items( &self, items: Vec<SelectItem<'_>>, ) -> Result<DataFrame, PolarsError>
pub fn filter(&self, condition: Expr) -> Result<DataFrame, PolarsError>
pub fn filter_engine(&self, condition: Expr) -> Result<DataFrame, EngineError>
pub fn column(&self, name: &str) -> Result<Column, PolarsError>
pub fn with_column( &self, column_name: &str, col: &Column, ) -> Result<DataFrame, PolarsError>
pub fn with_column_engine( &self, column_name: &str, col: &Column, ) -> Result<DataFrame, EngineError>
pub fn with_column_expr( &self, column_name: &str, expr: Expr, ) -> Result<DataFrame, PolarsError>
pub fn group_by( &self, column_names: Vec<&str>, ) -> Result<GroupedData, PolarsError>
pub fn group_by_engine( &self, column_names: Vec<&str>, ) -> Result<GroupedData, EngineError>
pub fn group_by_exprs( &self, exprs: Vec<Expr>, grouping_col_names: Vec<String>, ) -> Result<GroupedData, PolarsError>
pub fn cube( &self, column_names: Vec<&str>, ) -> Result<CubeRollupData, PolarsError>
pub fn rollup( &self, column_names: Vec<&str>, ) -> Result<CubeRollupData, PolarsError>
pub fn agg(&self, aggregations: Vec<Expr>) -> Result<DataFrame, PolarsError>
pub fn join( &self, other: &DataFrame, on: Vec<&str>, how: JoinType, ) -> Result<DataFrame, PolarsError>
pub fn order_by( &self, column_names: Vec<&str>, ascending: Vec<bool>, ) -> Result<DataFrame, PolarsError>
pub fn order_by_exprs( &self, sort_orders: Vec<SortOrder>, ) -> Result<DataFrame, PolarsError>
pub fn union(&self, other: &DataFrame) -> Result<DataFrame, PolarsError>
pub fn union_all(&self, other: &DataFrame) -> Result<DataFrame, PolarsError>
pub fn union_by_name( &self, other: &DataFrame, allow_missing_columns: bool, ) -> Result<DataFrame, PolarsError>
pub fn distinct( &self, subset: Option<Vec<&str>>, ) -> Result<DataFrame, PolarsError>
pub fn drop(&self, columns: Vec<&str>) -> Result<DataFrame, PolarsError>
pub fn dropna( &self, subset: Option<Vec<&str>>, how: &str, thresh: Option<usize>, ) -> Result<DataFrame, PolarsError>
pub fn fillna( &self, value: Expr, subset: Option<Vec<&str>>, ) -> Result<DataFrame, PolarsError>
pub fn limit(&self, n: usize) -> Result<DataFrame, PolarsError>
pub fn limit_engine(&self, n: usize) -> Result<DataFrame, EngineError>
pub fn with_column_renamed( &self, old_name: &str, new_name: &str, ) -> Result<DataFrame, PolarsError>
pub fn replace( &self, column_name: &str, old_value: Expr, new_value: Expr, ) -> Result<DataFrame, PolarsError>
pub fn cross_join(&self, other: &DataFrame) -> Result<DataFrame, PolarsError>
pub fn describe(&self) -> Result<DataFrame, PolarsError>
pub fn cache(&self) -> Result<DataFrame, PolarsError>
pub fn persist(&self) -> Result<DataFrame, PolarsError>
pub fn unpersist(&self) -> Result<DataFrame, PolarsError>
pub fn subtract(&self, other: &DataFrame) -> Result<DataFrame, PolarsError>
pub fn intersect(&self, other: &DataFrame) -> Result<DataFrame, PolarsError>
pub fn sample( &self, with_replacement: bool, fraction: f64, seed: Option<u64>, ) -> Result<DataFrame, PolarsError>
pub fn random_split( &self, weights: &[f64], seed: Option<u64>, ) -> Result<Vec<DataFrame>, PolarsError>
pub fn sample_by( &self, col_name: &str, fractions: &[(Expr, f64)], seed: Option<u64>, ) -> Result<DataFrame, PolarsError>
pub fn first(&self) -> Result<DataFrame, PolarsError>
pub fn head(&self, n: usize) -> Result<DataFrame, PolarsError>
pub fn take(&self, n: usize) -> Result<DataFrame, PolarsError>
pub fn tail(&self, n: usize) -> Result<DataFrame, PolarsError>
pub fn is_empty(&self) -> bool
pub fn to_df(&self, names: Vec<&str>) -> Result<DataFrame, PolarsError>
pub fn stat(&self) -> DataFrameStat<'_>
pub fn corr(&self) -> Result<DataFrame, PolarsError>
pub fn corr_cols(&self, col1: &str, col2: &str) -> Result<f64, PolarsError>
pub fn cov_cols(&self, col1: &str, col2: &str) -> Result<f64, PolarsError>
pub fn summary(&self) -> Result<DataFrame, PolarsError>
pub fn to_json(&self) -> Result<Vec<String>, PolarsError>
pub fn explain(&self) -> String
pub fn print_schema(&self) -> Result<String, PolarsError>
pub fn checkpoint(&self) -> Result<DataFrame, PolarsError>
pub fn local_checkpoint(&self) -> Result<DataFrame, PolarsError>
pub fn repartition( &self, num_partitions: usize, ) -> Result<DataFrame, PolarsError>
pub fn repartition_by_range( &self, num_partitions: usize, columns: Vec<&str>, ) -> Result<DataFrame, PolarsError>
pub fn dtypes(&self) -> Result<Vec<(String, String)>, PolarsError>
pub fn sort_within_partitions( &self, cols: &[SortOrder], ) -> Result<DataFrame, PolarsError>
pub fn coalesce(&self, num_partitions: usize) -> Result<DataFrame, PolarsError>
pub fn hint(&self, name: &str, params: &[i32]) -> Result<DataFrame, PolarsError>
pub fn is_local(&self) -> bool
pub fn input_files(&self) -> Vec<String>
pub fn same_semantics(&self, other: &DataFrame) -> bool
pub fn semantic_hash(&self) -> u64
pub fn observe(&self, name: &str, expr: Expr) -> Result<DataFrame, PolarsError>
pub fn with_watermark( &self, event_time: &str, delay_threshold: &str, ) -> Result<DataFrame, PolarsError>
pub fn select_expr(&self, exprs: &[String]) -> Result<DataFrame, PolarsError>
pub fn col_regex(&self, pattern: &str) -> Result<DataFrame, PolarsError>
pub fn with_columns( &self, exprs: &[(String, Column)], ) -> Result<DataFrame, PolarsError>
pub fn with_columns_renamed( &self, renames: &[(String, String)], ) -> Result<DataFrame, PolarsError>
pub fn na(&self) -> DataFrameNa<'_>
pub fn offset(&self, n: usize) -> Result<DataFrame, PolarsError>
pub fn transform<F>(&self, f: F) -> Result<DataFrame, PolarsError>
pub fn freq_items( &self, columns: &[&str], support: f64, ) -> Result<DataFrame, PolarsError>
pub fn approx_quantile( &self, column: &str, probabilities: &[f64], ) -> Result<DataFrame, PolarsError>
pub fn crosstab(&self, col1: &str, col2: &str) -> Result<DataFrame, PolarsError>
Sourcepub fn write(&self) -> DataFrameWriter<'_>
pub fn write(&self) -> DataFrameWriter<'_>
Write this DataFrame to path (returns root-owned writer).
pub fn write_delta( &self, _path: impl AsRef<Path>, _overwrite: bool, ) -> Result<(), PolarsError>
Sourcepub fn save_as_delta_table(&self, session: &SparkSession, name: &str)
pub fn save_as_delta_table(&self, session: &SparkSession, name: &str)
Register as delta table by name.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DataFrame
impl !RefUnwindSafe for DataFrame
impl Send for DataFrame
impl Sync for DataFrame
impl Unpin for DataFrame
impl UnsafeUnpin for DataFrame
impl !UnwindSafe for DataFrame
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> ⓘ
Converts
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> ⓘ
Converts
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