nodejs-polars
Version:
Polars: Blazingly fast DataFrames in Rust, Python, Node.js, R and SQL
218 lines (217 loc) • 5.32 kB
TypeScript
/**
* Downsample rules
*/
export type DownsampleRule = "month" | "week" | "day" | "hour" | "minute" | "second";
/**
* Fill null strategies
*/
export type FillNullStrategy = "backward" | "forward" | "mean" | "min" | "max" | "zero" | "one";
/**
* Rank methods
*/
export type RankMethod = "average" | "min" | "max" | "dense" | "ordinal" | "random";
/**
* Options for {@link concat}
*/
export interface ConcatOptions {
rechunk?: boolean;
how?: "vertical" | "horizontal" | "diagonal";
}
/**
* Options for @see {@link DataFrame.writeCSV}
* Options for @see {@link LazyDataFrame.sinkCSV}
* @category Options
*/
export interface CsvWriterOptions {
includeBom?: boolean;
includeHeader?: boolean;
separator?: string;
quoteChar?: string;
lineTerminator?: string;
batchSize?: number;
datetimeFormat?: string;
dateFormat?: string;
timeFormat?: string;
floatPrecision?: number;
nullValue?: string;
maintainOrder?: boolean;
}
/**
* Options for @see {@link LazyDataFrame.sinkParquet}
* @category Options
*/
export interface SinkParquetOptions {
compression?: string;
compressionLevel?: number;
statistics?: boolean;
rowGroupSize?: number;
dataPagesizeLimit?: number;
maintainOrder?: boolean;
typeCoercion?: boolean;
predicatePushdown?: boolean;
projectionPushdown?: boolean;
simplifyExpression?: boolean;
slicePushdown?: boolean;
noOptimization?: boolean;
cloudOptions?: Map<string, string>;
retries?: number;
}
/**
* Options for {@link DataFrame.writeJSON}
* @category Options
*/
export interface WriteJsonOptions {
orient?: "row" | "col" | "dataframe";
multiline?: boolean;
}
/**
* Options for {@link scanJson}
*/
export interface JsonScanOptions {
inferSchemaLength?: number;
nThreads?: number;
batchSize?: number;
lowMemory?: boolean;
numRows?: number;
skipRows?: number;
rowCount?: RowCount;
}
/**
* Options for {@link DataFrame.writeParquet}
* @category Options
*/
export interface WriteParquetOptions {
compression?: "uncompressed" | "snappy" | "gzip" | "lzo" | "brotli" | "lz4" | "zstd";
}
/**
* Options for {@link readParquet}
*/
export interface ReadParquetOptions {
columns?: string[] | number[];
numRows?: number;
parallel?: "auto" | "columns" | "row_groups" | "none";
rowCount?: RowCount;
}
/**
* Options for {@link scanParquet}
*/
export interface ScanParquetOptions {
nRows?: number;
rowIndexName?: string;
rowIndexOffset?: number;
cache?: boolean;
parallel?: "auto" | "columns" | "row_groups" | "none";
glob?: boolean;
hivePartitioning?: boolean;
hiveSchema?: unknown;
tryParseHiveDates?: boolean;
rechunk?: boolean;
lowMemory?: boolean;
useStatistics?: boolean;
cloudOptions?: Map<string, string>;
retries?: number;
includeFilePaths?: string;
allowMissingColumns?: boolean;
}
/**
* Add row count as column
*/
export interface RowCount {
/** name of column */
name: string;
/** offset */
offset: number;
}
/**
* Options for {@link DataFrame.writeIPC}
* @category Options
*/
export interface WriteIPCOptions {
compression?: "uncompressed" | "lz4" | "zstd";
}
/**
* Options for writing Avro files
* @category Options
*/
export interface WriteAvroOptions {
compression?: "uncompressed" | "snappy" | "deflate";
}
/**
* Interpolation types
*/
export type InterpolationMethod = "nearest" | "higher" | "lower" | "midpoint" | "linear";
/**
* Join types
*/
export type JoinType = "left" | "inner" | "full" | "semi" | "anti" | "cross";
/** @ignore */
export type JoinBaseOptions = {
how?: JoinType;
suffix?: string;
};
/**
* options for join operations @see {@link DataFrame.join}
*/
export interface JoinOptions {
/** left join column */
leftOn?: string | Array<string>;
/** right join column */
rightOn?: string | Array<string>;
/** left and right join column */
on?: string | Array<string>;
/** join type */
how?: JoinType;
suffix?: string;
}
/**
* options for lazy join operations @see {@link LazyDataFrame.join}
*/
export interface LazyJoinOptions extends JoinOptions {
allowParallel?: boolean;
forceParallel?: boolean;
}
/**
* options for lazy operations @see {@link LazyDataFrame.collect}
*/
export type LazyOptions = {
typeCoercion?: boolean;
predicatePushdown?: boolean;
projectionPushdown?: boolean;
simplifyExpression?: boolean;
slicePushdown?: boolean;
noOptimization?: boolean;
commSubplanElim?: boolean;
commSubexprElim?: boolean;
streaming?: boolean;
};
/**
* options for rolling window operations
* @category Options
*/
export interface RollingOptions {
windowSize: number;
weights?: Array<number>;
minPeriods?: number;
center?: boolean;
ddof?: number;
}
/**
* options for rolling quantile operations
* @category Options
*/
export interface RollingQuantileOptions extends RollingOptions {
quantile: number;
interpolation?: InterpolationMethod;
}
/**
* options for rolling mean operations
* @category Options
*/
export interface RollingSkewOptions {
windowSize: number;
bias?: boolean;
}
/**
* ClosedWindow types
*/
export type ClosedWindow = "None" | "Both" | "Left" | "Right";