import { type DataFrame, type JoinSchemas, type Schema } from "../dataframe"; import type { Series } from "../series"; import type { Deserialize, GroupByOps, Serialize } from "../shared_traits"; import type { CollectSyncOptions, CsvWriterOptions, LazyCrossJoinOptions, LazyDifferentNameColumnJoinOptions, LazyOptions, LazySameNameColumnJoinOptions, SinkIpcOptions, SinkJsonOptions, SinkParquetOptions } from "../types"; import { type ColumnSelection, type ColumnsOrExpr, type ExprOrString, type Simplify, type ValueOrArray } from "../utils"; import { Expr } from "./expr"; import { type LazyGroupBy } from "./groupby"; declare const inspect: unique symbol; /** * Representation of a Lazy computation graph / query. */ export interface LazyDataFrame extends Serialize, GroupByOps { /** @ignore */ _ldf: any; [inspect](): string; [Symbol.toStringTag]: string; get columns(): string[]; /** * Cache the result once the execution of the physical plan hits this node. */ cache(): LazyDataFrame; clone(): LazyDataFrame; /** * * Collect into a DataFrame. * Note: use `fetch` if you want to run this query on the first `n` rows only. * This can be a huge time saver in debugging queries. * @param opts.typeCoercion -Do type coercion optimization. * @param opts.predicatePushdown - Do predicate pushdown optimization. * @param opts.projectionPushdown - Do projection pushdown optimization. * @param opts.simplifyExpression - Run simplify expressions optimization. * @param opts.noOptimization - Turn off optimizations. * @param opts.commSubplanElim - Will try to cache branching subplans that occur on self-joins or unions. * @param opts.commSubexprElim - Common subexpressions will be cached and reused. * @param opts.engine - Engine used to execute the query. Defaults to `"streaming"` when `opts.streaming` is `true`, otherwise `"auto"`. * @param opts.streaming - Process the query in batches to handle larger-than-memory data. Implies `engine: "streaming"` unless `engine` is set explicitly. If set to `False` (default), the entire query is processed in a single batch. .. warning:: Streaming mode is considered **unstable**. It may be changed at any point without it being considered a breaking change. * @return DataFrame * */ collect(opts?: LazyOptions): Promise>; /** * Materialize this LazyFrame into a DataFrame. By default, all query optimizations are enabled. * @param opts.engine - Engine to use for execution * Select the engine used to process the query, optional. At the moment, if set to `"auto"` (default), the query is run using the polars in-memory engine. Polars will also attempt to use the engine set by the `POLARS_ENGINE_AFFINITY` environment variable. If it cannot run the query using the selected engine, the query is run using the polars in-memory engine. */ collectSync(opts?: CollectSyncOptions): DataFrame; /** * A string representation of the optimized query plan. */ describeOptimizedPlan(opts?: LazyOptions): string; /** * A string representation of the unoptimized query plan. */ describePlan(): string; /** * Remove one or multiple columns from a DataFrame. * @param name - column or list of columns to be removed */ drop(name: U): LazyDataFrame>>; drop(names: U): LazyDataFrame>>; drop(name: U, ...names: V): LazyDataFrame>>; /** * Drop rows with null values from this DataFrame. * This method only drops nulls row-wise if any single value of the row is null. */ dropNulls(column: string): LazyDataFrame; dropNulls(columns: string[]): LazyDataFrame; dropNulls(...columns: string[]): LazyDataFrame; /** * Explode lists to long format. */ explode(column: ExprOrString): LazyDataFrame; explode(columns: ExprOrString[]): LazyDataFrame; explode(column: ExprOrString, ...columns: ExprOrString[]): LazyDataFrame; /** * Fill floating point NaN values. * @param fillValue value to fill the NaN values with * @example * ``` * > const lf = pl.DataFrame({ * > "a": [1.5, 2, Number.NaN, 4], * > "b": [0.5, 4, Number.NaN, 13], * > }).lazy() * > lf.fillNan(99).collect() * shape: (4, 2) * ┌──────┬──────┐ * │ a ┆ b │ * │ --- ┆ --- │ * │ f64 ┆ f64 │ * ╞══════╪══════╡ * │ 1.5 ┆ 0.5 │ * │ 2.0 ┆ 4.0 │ * │ 99.0 ┆ 99.0 │ * │ 4.0 ┆ 13.0 │ * └──────┴──────┘ * ``` */ fillNan(fillValue: number | Expr): LazyDataFrame; /** * Fill missing values * @param fillValue value to fill the missing values with */ fillNull(fillValue: string | number | Expr): LazyDataFrame; /** * Filter the rows in the DataFrame based on a predicate expression. * @param predicate - Expression that evaluates to a boolean Series. * @example * ``` * > lf = pl.DataFrame({ * > "foo": [1, 2, 3], * > "bar": [6, 7, 8], * > "ham": ['a', 'b', 'c'] * > }).lazy() * > // Filter on one condition * > lf.filter(pl.col("foo").lt(3)).collect() * shape: (2, 3) * ┌─────┬─────┬─────┐ * │ foo ┆ bar ┆ ham │ * │ --- ┆ --- ┆ --- │ * │ i64 ┆ i64 ┆ str │ * ╞═════╪═════╪═════╡ * │ 1 ┆ 6 ┆ a │ * ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤ * │ 2 ┆ 7 ┆ b │ * └─────┴─────┴─────┘ * ``` */ filter(predicate: Expr | string): LazyDataFrame; /** * Get the first row of the DataFrame. */ first(): DataFrame; /** * Start a groupby operation. */ groupBy(by: ColumnsOrExpr, maintainOrder?: boolean): LazyGroupBy; groupBy(by: ColumnsOrExpr, opts: { maintainOrder: boolean; }): LazyGroupBy; /** * Gets the first `n` rows of the DataFrame. You probably don't want to use this! * * Consider using the `fetch` operation. * The `fetch` operation will truly load the first `n`rows lazily. */ head(length?: number): LazyDataFrame; inner(): any; /** * __SQL like joins.__ * @param other - DataFrame to join with. * @param joinOptions - Join options, including the `on` columns and `how` strategy. * @see {@link LazySameNameColumnJoinOptions} * @example * ``` * >>> const df = pl.DataFrame({ * >>> foo: [1, 2, 3], * >>> bar: [6.0, 7.0, 8.0], * >>> ham: ['a', 'b', 'c'], * >>> }).lazy() * >>> * >>> const otherDF = pl.DataFrame({ * >>> apple: ['x', 'y', 'z'], * >>> ham: ['a', 'b', 'd'], * >>> }).lazy(); * >>> const result = await df.join(otherDF, { on: 'ham', how: 'inner' }).collect(); * shape: (2, 4) * ╭─────┬─────┬─────┬───────╮ * │ foo ┆ bar ┆ ham ┆ apple │ * │ --- ┆ --- ┆ --- ┆ --- │ * │ i64 ┆ f64 ┆ str ┆ str │ * ╞═════╪═════╪═════╪═══════╡ * │ 1 ┆ 6 ┆ "a" ┆ "x" │ * ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤ * │ 2 ┆ 7 ┆ "b" ┆ "y" │ * ╰─────┴─────┴─────┴───────╯ * ``` */ join, Extract>>(other: LazyDataFrame, joinOptions: Opts & LazySameNameColumnJoinOptions): LazyDataFrame>; /** * __SQL like joins with different names for left and right dataframes.__ * @param other - DataFrame to join with. * @param joinOptions - Join options, including the `leftOn`/`rightOn` columns and `how` strategy. * @see {@link LazyDifferentNameColumnJoinOptions} * @example * ``` * >>> const df = pl.DataFrame({ * >>> foo: [1, 2, 3], * >>> bar: [6.0, 7.0, 8.0], * >>> ham: ['a', 'b', 'c'], * >>> }).lazy() * >>> * >>> const otherDF = pl.DataFrame({ * >>> apple: ['x', 'y', 'z'], * >>> ham: ['a', 'b', 'd'], * >>> }).lazy(); * >>> const result = await df.join(otherDF, { leftOn: 'ham', rightOn: 'ham', how: 'inner' }).collect(); * shape: (2, 4) * ╭─────┬─────┬─────┬───────╮ * │ foo ┆ bar ┆ ham ┆ apple │ * │ --- ┆ --- ┆ --- ┆ --- │ * │ i64 ┆ f64 ┆ str ┆ str │ * ╞═════╪═════╪═════╪═══════╡ * │ 1 ┆ 6 ┆ "a" ┆ "x" │ * ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤ * │ 2 ┆ 7 ┆ "b" ┆ "y" │ * ╰─────┴─────┴─────┴───────╯ * ``` */ join, Extract>>(other: LazyDataFrame, joinOptions: Opts & LazyDifferentNameColumnJoinOptions): LazyDataFrame>; /** * __SQL like cross joins.__ * @param other - DataFrame to join with. * @param joinOptions - Join options; `how` must be `'cross'`. * @see {@link LazyCrossJoinOptions} * @example * ``` * >>> const df = pl.DataFrame({ * >>> foo: [1, 2], * >>> bar: [6.0, 7.0], * >>> ham: ['a', 'b'], * >>> }).lazy() * >>> * >>> const otherDF = pl.DataFrame({ * >>> apple: ['x', 'y'], * >>> ham: ['a', 'b'], * >>> }).lazy(); * >>> const result = await df.join(otherDF, { how: 'cross' }).collect(); * shape: (4, 5) * ╭─────┬─────┬─────┬───────┬───────────╮ * │ foo ┆ bar ┆ ham ┆ apple ┆ ham_right │ * │ --- ┆ --- ┆ --- ┆ --- ┆ --- │ * │ f64 ┆ f64 ┆ str ┆ str ┆ str │ * ╞═════╪═════╪═════╪═══════╪═══════════╡ * │ 1.0 ┆ 6.0 ┆ a ┆ x ┆ a │ * │ 1.0 ┆ 6.0 ┆ a ┆ y ┆ b │ * │ 2.0 ┆ 7.0 ┆ b ┆ x ┆ a │ * │ 2.0 ┆ 7.0 ┆ b ┆ y ┆ b │ * ╰─────┴─────┴─────┴───────┴───────────╯ * ``` */ join(other: LazyDataFrame, joinOptions: Opts & LazyCrossJoinOptions): LazyDataFrame>; /** * Perform an asof join. This is similar to a left-join except that we * match on nearest key rather than equal keys. * * Both DataFrames must be sorted by the asof_join key. * For each row in the left DataFrame: - A "backward" search selects the last row in the right DataFrame whose 'on' key is less than or equal to the left's key. - A "forward" search selects the first row in the right DataFrame whose 'on' key is greater than or equal to the left's key. - A "nearest" search selects the last row in the right DataFrame whose value is nearest to the left's key. String keys are not currently supported for a nearest search. The default is "backward". Parameters ---------- @param other DataFrame to join with. @param options.leftOn Join column of the left DataFrame. @param options.rightOn Join column of the right DataFrame. @param options.on Join column of both DataFrames. If set, `leftOn` and `rightOn` should be undefined. @param options.byLeft join on these columns before doing asof join @param options.byRight join on these columns before doing asof join @param options.strategy One of {'forward', 'backward', 'nearest'} @param options.suffix Suffix to append to columns with a duplicate name. @param options.tolerance Numeric tolerance. By setting this the join will only be done if the near keys are within this distance. If an asof join is done on columns of dtype "Date", "Datetime" you use the following string language: - 1ns *(1 nanosecond)* - 1us *(1 microsecond)* - 1ms *(1 millisecond)* - 1s *(1 second)* - 1m *(1 minute)* - 1h *(1 hour)* - 1d *(1 day)* - 1w *(1 week)* - 1mo *(1 calendar month)* - 1y *(1 calendar year)* - 1i *(1 index count)* Or combine them: - "3d12h4m25s" # 3 days, 12 hours, 4 minutes, and 25 seconds @param options.allowParallel Allow the physical plan to optionally evaluate the computation of both DataFrames up to the join in parallel. @param options.forceParallel Force the physical plan to evaluate the computation of both DataFrames up to the join in parallel. @param options.checkSortedness Check the sortedness of the asof keys. If the keys are not sorted Polars will error, or in case of 'by' argument raise a warning. This might become a hard error in the future. @example ``` >const gdp = pl.DataFrame({ ... date: [ ... new Date('2016-01-01'), ... new Date('2017-01-01'), ... new Date('2018-01-01'), ... new Date('2019-01-01'), ... ], // note record date: Jan 1st (sorted!) ... gdp: [4164, 4411, 4566, 4696], ... }) >const population = pl.DataFrame({ ... date: [ ... new Date('2016-05-12'), ... new Date('2017-05-12'), ... new Date('2018-05-12'), ... new Date('2019-05-12'), ... ], // note record date: May 12th (sorted!) ... "population": [82.19, 82.66, 83.12, 83.52], ... }) >population.joinAsof( ... gdp, ... {leftOn:"date", rightOn:"date", strategy:"backward"} ... ) shape: (4, 3) ┌─────────────────────┬────────────┬──────┐ │ date ┆ population ┆ gdp │ │ --- ┆ --- ┆ --- │ │ datetime[μs] ┆ f64 ┆ i64 │ ╞═════════════════════╪════════════╪══════╡ │ 2016-05-12 00:00:00 ┆ 82.19 ┆ 4164 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤ │ 2017-05-12 00:00:00 ┆ 82.66 ┆ 4411 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤ │ 2018-05-12 00:00:00 ┆ 83.12 ┆ 4566 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤ │ 2019-05-12 00:00:00 ┆ 83.52 ┆ 4696 │ └─────────────────────┴────────────┴──────┘ ``` */ joinAsof(other: LazyDataFrame, options: { leftOn?: string; rightOn?: string; on?: string; byLeft?: string | string[]; byRight?: string | string[]; by?: string | string[]; strategy?: "backward" | "forward" | "nearest"; suffix?: string; tolerance?: number | string; allowParallel?: boolean; forceParallel?: boolean; checkSortedness?: boolean; coalesce?: boolean; allowExactMatches?: boolean; }): LazyDataFrame; /** * Get the last row of the DataFrame. */ last(): LazyDataFrame; /** * @see {@link head} */ limit(n?: number): LazyDataFrame; /** * @see {@link DataFrame.max} */ max(): LazyDataFrame; /** * @see {@link DataFrame.mean} */ mean(): LazyDataFrame; /** * @see {@link DataFrame.median} */ median(): LazyDataFrame; /** * @see {@link DataFrame.unpivot} */ unpivot(idVars: ColumnSelection, valueVars: ColumnSelection, options?: { variableName?: string | null; valueName?: string | null; }): LazyDataFrame; /** * @see {@link DataFrame.min} */ min(): LazyDataFrame; /** * @see {@link DataFrame.quantile} */ quantile(quantile: number, interpolation?: "nearest" | "higher" | "lower" | "midpoint" | "linear"): LazyDataFrame; /** * @see {@link DataFrame.rename} */ rename>>(mapping: U): LazyDataFrame<{ [K in keyof S as U[K] extends string ? U[K] : K]: S[K]; }>; rename(mapping: Record): LazyDataFrame; /** * Reverse the DataFrame. */ reverse(): LazyDataFrame; /** * @see {@link DataFrame.select} */ select(...columns: U[]): LazyDataFrame<{ [P in U]: S[P]; }>; select(column: ExprOrString | Series): LazyDataFrame; select(columns: (ExprOrString | Series)[]): LazyDataFrame; select(...columns: (ExprOrString | Series)[]): LazyDataFrame; /** * @see {@link DataFrame.shift} */ shift(periods: number): LazyDataFrame; shift(opts: { periods: number; }): LazyDataFrame; /** * @see {@link DataFrame.shiftAndFill} */ shiftAndFill(n: number, fillValue: number): LazyDataFrame; shiftAndFill(opts: { n: number; fillValue: number; }): LazyDataFrame; /** * @see {@link DataFrame.slice} */ slice(offset: number, length: number): LazyDataFrame; slice(opts: { offset: number; length: number; }): LazyDataFrame; /** * @see {@link DataFrame.sort} */ sort(by: ColumnsOrExpr, descending?: ValueOrArray, nullsLast?: ValueOrArray, maintainOrder?: boolean, multithreaded?: boolean): LazyDataFrame; sort(opts: { by: ColumnsOrExpr; descending?: ValueOrArray; nullsLast?: ValueOrArray; maintainOrder?: boolean; multithreaded?: boolean; }): LazyDataFrame; /** * @see {@link DataFrame.std} * @param ddof - "Delta Degrees of Freedom": the divisor used in the calculation is `N - ddof`, * where `N` represents the number of elements. By default `ddof` is 1. */ std(ddof?: number): LazyDataFrame; /** * Aggregate the columns in the DataFrame to their sum value. */ sum(): LazyDataFrame; /** * Get the last `n` rows of the DataFrame. * @see {@link DataFrame.tail} */ tail(length?: number): LazyDataFrame; /** * compatibility with `JSON.stringify` */ toJSON(): string; /** * Drop duplicate rows from this DataFrame. * Note that this fails if there is a column of type `List` in the DataFrame. * @param subset Column name(s), selector(s) to consider when identifying duplicate rows. If set to `None` (default), all columns are considered. * @param keep : 'first', 'last', 'any', 'none' * Which of the duplicate rows to keep. * 'any': Defaut, does not give any guarantee of which row is kept. This allows more optimizations. * 'none': Don't keep duplicate rows. * 'first': Keep the first unique row. * 'last': Keep the last unique row. * @param maintainOrder Keep the same order as the original DataFrame. This is more expensive to compute. Default: false * @returns LazyDataFrame with unique rows. * @example * const ldf = pl.DataFrame({ foo: [1, 2, 2, 3], bar: [1, 2, 2, 4], ham: ["a", "d", "d", "c"], }).lazy(); > ldf.unique().collectSync(); By default, all columns are considered when determining which rows are unique: shape: (3, 3) ┌─────┬─────┬─────┐ │ foo ┆ bar ┆ ham │ │ --- ┆ --- ┆ --- │ │ f64 ┆ f64 ┆ str │ ╞═════╪═════╪═════╡ │ 3.0 ┆ 4.0 ┆ c │ │ 1.0 ┆ 1.0 ┆ a │ │ 2.0 ┆ 2.0 ┆ d │ └─────┴─────┴─────┘ > ldf.unique("foo").collectSync(); shape: (3, 3) ┌─────┬─────┬─────┐ │ foo ┆ bar ┆ ham │ │ --- ┆ --- ┆ --- │ │ f64 ┆ f64 ┆ str │ ╞═════╪═════╪═════╡ │ 3.0 ┆ 4.0 ┆ c │ │ 1.0 ┆ 1.0 ┆ a │ │ 2.0 ┆ 2.0 ┆ d │ └─────┴─────┴─────┘ > ldf.unique(["foo", "ham"], "first", true).collectSync(); or df.unique({ subset: ["foo", "ham"], keep: "first", maintainOrder: true }).collectSync(); shape: (3, 3) ┌─────┬─────┬─────┐ │ foo ┆ bar ┆ ham │ │ --- ┆ --- ┆ --- │ │ f64 ┆ f64 ┆ str │ ╞═════╪═════╪═════╡ │ 1.0 ┆ 1.0 ┆ a │ │ 2.0 ┆ 2.0 ┆ d │ │ 3.0 ┆ 4.0 ┆ c │ └─────┴─────┴─────┘ */ unique(subset?: ColumnSelection, keep?: "first" | "last" | "any" | "none", maintainOrder?: boolean): LazyDataFrame; unique(opts: { subset?: ColumnSelection; keep?: "first" | "last" | "any" | "none"; maintainOrder?: boolean; }): LazyDataFrame; /** * Decompose struct columns into separate columns for each of their fields. * The new columns will be inserted into the DataFrame at the location of the struct column. * @param columns Name of the struct column(s) that should be unnested. * @param separator Rename output column names as combination of the struct column name, name separator and field name. * @example * ``` * > const lf = pl.DataFrame({ * > "before": ["foo", "bar"], * > "t_a": [1, 2], * > "t_b": ["a", "b"], * > }).lazy().select( * > pl.col("before"), * > pl.struct(["t_a", "t_b"]).alias("t_struct"), * > ) * > lf.unnest("t_struct").collect() * shape: (2, 3) * ┌────────┬─────┬─────┐ * │ before ┆ t_a ┆ t_b │ * │ --- ┆ --- ┆ --- │ * │ str ┆ i64 ┆ str │ * ╞════════╪═════╪═════╡ * │ foo ┆ 1 ┆ a │ * │ bar ┆ 2 ┆ b │ * └────────┴─────┴─────┘ * ``` */ unnest(columns: string | string[], separator?: string): LazyDataFrame; /** * Aggregate the columns in the DataFrame to their variance value. * @param ddof - "Delta Degrees of Freedom": the divisor used in the calculation is `N - ddof`, * where `N` represents the number of elements. By default `ddof` is 1. */ var(ddof?: number): LazyDataFrame; /** * Add or overwrite column in a DataFrame. * @param expr - Expression that evaluates to column. */ withColumn(expr: Expr | Series): LazyDataFrame; /** * Add or overwrite multiple columns in a DataFrame. * @param exprs - List of Expressions that evaluate to columns. * */ withColumns(...exprs: (Expr | Series)[]): LazyDataFrame; withColumnRenamed(existing: Existing, replacement: New): LazyDataFrame<{ [K in keyof S as K extends Existing ? New : K]: S[K]; }>; withColumnRenamed(existing: string, replacement: string): LazyDataFrame; /** * Add a row index as the first column in the DataFrame. * @param name Name of the index column. * @param offset Start the index at this offset. Cannot be negative. * @example * * >>> ldf = pl.DataFrame( ... { ... "a": [1, 3, 5], ... "b": [2, 4, 6], ... } ... ).lazy(); >>> ldf.withRowIndex().collectSync(); shape: (3, 3) ┌───────┬─────┬─────┐ │ index ┆ a ┆ b │ │ --- ┆ --- ┆ --- │ │ u32 ┆ i64 ┆ i64 │ ╞═══════╪═════╪═════╡ │ 0 ┆ 1 ┆ 2 │ │ 1 ┆ 3 ┆ 4 │ │ 2 ┆ 5 ┆ 6 │ └───────┴─────┴─────┘ >>> ldf.withRowIndex("id", offset=1000).collectSync(); shape: (3, 3) ┌──────┬─────┬─────┐ │ id ┆ a ┆ b │ │ --- ┆ --- ┆ --- │ │ u32 ┆ i64 ┆ i64 │ ╞══════╪═════╪═════╡ │ 1000 ┆ 1 ┆ 2 │ │ 1001 ┆ 3 ┆ 4 │ │ 1002 ┆ 5 ┆ 6 │ └──────┴─────┴─────┘ */ withRowIndex(name?: string, offset?: number): LazyDataFrame; /*** * * Evaluate the query in streaming mode and write to a CSV file. .. warning:: Streaming mode is considered **unstable**. It may be changed at any point without it being considered a breaking change. This allows streaming results that are larger than RAM to be written to disk. Parameters ---------- @param path - File path to which the file should be written. @param options.includeBom - Whether to include UTF-8 BOM in the CSV output. @param options.includeHeader - Whether to include header in the CSV output. @param options.separator - Separate CSV fields with this symbol. @param options.lineTerminator - String used to end each row. @param options.quoteChar - Byte to use as quoting character. Default: '"' @param options.batchSize - Number of rows that will be processed per thread. Default - 1024 @param options.datetimeFormat - A format string, with the specifiers defined by the `chrono `_ Rust crate. If no format specified, the default fractional-second precision is inferred from the maximum timeunit found in the frame's Datetime cols (if any). @param options.dateFormat - A format string, with the specifiers defined by the `chrono `_ Rust crate. @param options.timeFormat A format string, with the specifiers defined by the `chrono `_ Rust crate. @param options.floatScientific - Whether to use scientific form always (true), never (false), or automatically (null) for `Float32` and `Float64` datatypes. @param options.floatPrecision - Number of decimal places to write, applied to both `Float32` and `Float64` datatypes. @param options.decimalComma - Use a comma as the decimal separator instead of a period. Default - false @param options.nullValue - A string representing null values (defaulting to the empty string). @param options.quoteStyle - Determines the quoting strategy used: 'necessary' (default), 'always', 'non_numeric', or 'never'. @param options.compression : {'uncompressed', 'gzip', 'zstd'} - Compression to apply to the output. Default - 'uncompressed' @param options.compressionLevel - The level of compression to use. Only applies to 'gzip' and 'zstd'. @param options.checkExtension - Whether to verify the path's extension matches the chosen `compression`. Default - true @param options.maintainOrder - Maintain the order in which data is processed. Setting this to `False` will be slightly faster. @param options.cloudOptions - Options that indicate how to connect to a cloud provider. Also accepts the retry keys `max_retries`, `retry_timeout_ms`, `retry_init_backoff_ms`, `retry_max_backoff_ms`, `retry_base_multiplier`, and `file_cache_ttl`. @param options.syncOnClose : {'none', 'data', 'all'} - Sync to disk when the file is closed. Default - 'none' @param options.mkdir - Recursively create all the directories in the path. Default - false @return DataFrame Examples -------- >>> const lf = pl.scanCsv("/path/to/my_larger_than_ram_file.csv") >>> lf.sinkCsv("out.csv").collect() */ sinkCSV(path: string, options?: CsvWriterOptions): LazyDataFrame; /*** * * Evaluate the query in streaming mode and write to a Parquet file. This allows streaming results that are larger than RAM to be written to disk. Parameters ---------- @param path - File path to which the file should be written. @param options.compression : {'lz4', 'uncompressed', 'snappy', 'gzip', 'lzo', 'brotli', 'zstd'} Choose "zstd" for good compression performance. (default) Choose "lz4" for fast compression/decompression. Choose "snappy" for more backwards compatibility guarantees when you deal with older parquet readers. @param options.compressionLevel - The level of compression to use. Higher compression means smaller files on disk. - "gzip" : min-level: 0, max-level: 10. - "brotli" : min-level: 0, max-level: 11. - "zstd" : min-level: 1, max-level: 22. @param options.statistics - Write statistics to the parquet headers. This requires extra compute. Default -> true Possible values: * `true`: enable the default set of statistics. Some statistics may be disabled. * `false`: disable all statistics. * `"full"`: calculate and write all available statistics. * `{ min, max, distinctCount, nullCount }`: enable a specific set of statistics. Keys that are omitted are disabled. @param options.rowGroupSize - Size of the row groups in number of rows. If not set, the chunks of the `DataFrame` are used. Writing in smaller chunks may reduce memory pressure and improve writing speeds. @param options.dataPagesizeLimit - Size limit of individual data pages. If not set defaults to 1024 * 1024 bytes @param options.maintainOrder - Maintain the order in which data is processed. Default -> true Setting this to `false` will be slightly faster. @param options.mkdir - Recursively create all the directories in the path. Default -> false @param options.syncOnClose - { 'none', 'data', 'all' } Default -> 'none' Sync to disk when closing a file. * `none` does not sync. * `data` syncs the file contents. * `all` syncs the file contents and metadata. @param options.cloudOptions - Options that indicate how to connect to a cloud provider. If the cloud provider is not supported by Polars, the storage options are passed to `fsspec.open()`. The cloud providers currently supported are AWS, GCP, and Azure. See supported keys here: * `aws `_ * `gcp `_ * `azure `_ If `cloudOptions` is not provided, Polars will try to infer the information from environment variables. @return DataFrame Examples -------- >>> const lf = pl.scanCsv("/path/to/my_larger_than_ram_file.csv") # doctest: +SKIP >>> lf.sinkParquet("out.parquet").collect() # doctest: +SKIP */ sinkParquet(path: string, options?: SinkParquetOptions): LazyDataFrame; /** * * Evaluate the query in streaming mode and write to an NDJSON file. * This allows streaming results that are larger than RAM to be written to disk. * * Parameters @param path - File path to which the file should be written. @param options.compression : {'uncompressed', 'gzip', 'zstd'} Default -> 'uncompressed' What compression format to use. @param options.compressionLevel - The compression level to use, typically 0-9, or undefined to let the engine choose. @param options.checkExtension - Whether to check if the filename matches the compression settings. Default -> true Will raise an error if compression is set to 'uncompressed' and the filename ends in one of (".gz", ".zst", ".zstd") or if compression != 'uncompressed' and the file uses a mismatched extension. @param options.maintainOrder - Maintain the order in which data is processed. Default -> true Setting this to `False` will be slightly faster. @param options.mkdir - Recursively create all the directories in the path. Default -> false @param options.syncOnClose - { 'none', 'data', 'all' } Default -> 'none' Sync to disk when before closing a file. * `none` does not sync. * `data` syncs the file contents. * `all` syncs the file contents and metadata. @param options.cloudOptions - Options that indicate how to connect to a cloud provider. If the cloud provider is not supported by Polars, the storage options are passed to `fsspec.open()`. The cloud providers currently supported are AWS, GCP, and Azure. See supported keys here: * `aws `_ * `gcp `_ * `azure `_ If `cloudOptions` is not provided, Polars will try to infer the information from environment variables. @return DataFrame Examples -------- >>> const lf = pl.scanCsv("/path/to/my_larger_than_ram_file.csv") # doctest: +SKIP >>> lf.sinkNdJson("out.ndjson").collect() */ sinkNdJson(path: string, options?: SinkJsonOptions): LazyDataFrame; /** * * Evaluate the query in streaming mode and write to an IPC file. * This allows streaming results that are larger than RAM to be written to disk. * * Parameters @param path - File path to which the file should be written. @param options.compression : {'uncompressed', 'lz4', 'zstd'} Choose "zstd" for good compression performance. Choose "lz4" for fast compression/decompression. @param options.compatLevel : { 'newest', 'oldest' } Default -> newest Use a specific compatibility level when exporting Polars' internal data structures. @param options.maintainOrder - Maintain the order in which data is processed. Default -> true Setting this to `False` will be slightly faster. @param options.mkdir - Recursively create all the directories in the path. Default -> false @param options.syncOnClose - { 'none', 'data', 'all' } Default -> 'none' Sync to disk when before closing a file. * `none` does not sync. * `data` syncs the file contents. * `all` syncs the file contents and metadata. @param options.cloudOptions - Options that indicate how to connect to a cloud provider. If the cloud provider is not supported by Polars, the storage options are passed to `fsspec.open()`. The cloud providers currently supported are AWS, GCP, and Azure. See supported keys here: * `aws `_ * `gcp `_ * `azure `_ If `cloudOptions` is not provided, Polars will try to infer the information from environment variables. @return DataFrame Examples -------- >>> const lf = pl.scanCsv("/path/to/my_larger_than_ram_file.csv") # doctest: +SKIP >>> lf.sinkIpc("out.arrow").collect() */ sinkIpc(path: string, options?: SinkIpcOptions): LazyDataFrame; } /** @ignore */ export declare const _LazyDataFrame: (_ldf: any) => LazyDataFrame; export interface LazyDataFrameConstructor extends Deserialize { fromExternal(external: any): LazyDataFrame; isLazyDataFrame(arg: any): arg is LazyDataFrame; } /** @ignore */ export declare const LazyDataFrame: LazyDataFrameConstructor; export {};