pl
Namespace: Polars.FSharp
The main entry point for Polars.NET F# API.
Contains factories for Expressions (pl.col, pl.lit), shortcuts for DataFrame operations, and types.
Properties & Indexers
| Property | Type | Description |
|---|---|---|
boolean | DataType | Boolean data type. |
date | DataType | Date data type (no time). |
element | Expr | Alias for an element being evaluated in an eval or filter expression. |
emptySchema | PolarsSchema | Create an empty schema. |
float16 | DataType | 16-bit Floating point data type. |
float32 | DataType | 32-bit Floating point data type. |
float64 | DataType | 64-bit Floating point data type. |
int128 | DataType | 128-bit Integer data type. |
int16 | DataType | 16-bit Integer data type. |
int32 | DataType | 32-bit Integer data type. |
int64 | DataType | 64-bit Integer data type. |
int8 | DataType | 8-bit Integer data type. |
nullType | DataType | Create a Null data type. |
sameAsInputType | DataType | Create a SameAsInputType data type. |
string | DataType | String data type (UTF-8). |
time | DataType | Time data type (no date). |
uint16 | DataType | 16-bit Unsigned Integer data type. |
uint32 | DataType | 32-bit Unsigned Integer data type. |
uint64 | DataType | 64-bit Unsigned Integer data type. |
uint8 | DataType | 8-bit Unsigned Integer data type. |
unknownType | DataType | Create an Unknown data type.(Same as SameAsInputType) |
utf8 | DataType | alias of String |
Module Functions
pl.alias
Alias an expression with a new name.
pl.alias : name: string -> expr: Expr -> ExprParameters
| Name | Type | Description |
|---|---|---|
name | string | - |
expr | Expr | - |
pl.alignDataFrames
Align a sequence of DataFrames on a common schema.
pl.alignDataFrames : on: seq<Expr> -> how: JoinType -> select: seq<Expr> option -> descending: bool -> frames: seq<DataFrame> -> DataFrame[]Parameters
| Name | Type | Description |
|---|---|---|
on | seq<Expr> | - |
how | JoinType | - |
select | seq<Expr> option | - |
descending | bool | - |
frames | seq<DataFrame> | - |
pl.alignDataFramesAsync
Align a sequence of DataFrames on a common schema asynchronously.
pl.alignDataFramesAsync : on: seq<Expr> -> how: JoinType -> select: seq<Expr> option -> descending: bool -> frames: seq<DataFrame> -> FSharpAsync<DataFrame[]>Parameters
| Name | Type | Description |
|---|---|---|
on | seq<Expr> | - |
how | JoinType | - |
select | seq<Expr> option | - |
descending | bool | - |
frames | seq<DataFrame> | - |
pl.alignLazyFrames
Align a sequence of frames using common values from one or more columns as a key.
pl.alignLazyFrames : on: seq<Expr> -> how: JoinType -> select: seq<Expr> option -> descending: bool -> frames: seq<LazyFrame> -> LazyFrame[]Parameters
| Name | Type | Description |
|---|---|---|
on | seq<Expr> | One or more columns whose unique values will be used to align the frames. |
how | JoinType | Join strategy; defaults to outer join. |
select | seq<Expr> option | Optional post-alignment column select. |
descending | bool | Sort the alignment column values in descending order. |
frames | seq<LazyFrame> | Sequence of DataFrames or LazyFrames. |
pl.all
Select all columns. Equivalent to pl.col("*").
pl.all : unit -> Exprpl.allHorizontal
Compute the logical AND horizontally across columns.
Kleene logic is used to deal with nulls: if the column contains any null values and no True values, the output is null.
pl.allHorizontal : exprs: seq<Expr> -> ExprParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<Expr> | Column(s) to use in the aggregation. |
pl.allOf
Evaluate a bitwise AND operation on the specified columns. This function is syntactic sugar for col(names).all().
pl.allOf : names: seq<string> -> ignoreNulls: bool -> ExprParameters
| Name | Type | Description |
|---|---|---|
names | seq<string> | The names of the columns to aggregate. |
ignoreNulls | bool | If set to True (default), null values are ignored. If there are no non-null values, the output is False. If set to False, Kleene logic is used to deal with nulls: if the column contains any null values and no True values, the output is null. |
Returns: A boolean aggregation expression.
pl.any
Evaluate a bitwise OR operation.
pl.any : exprs: seq<string> -> ignoreNulls: bool -> ExprParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<string> | Column(s) to use in aggregation. |
ignoreNulls | bool | If set to True (default), null values are ignored. If there are no non-null values, the output is False. If set to False, Kleene logic is used to deal with nulls: if the column contains any null values and no True values, the output is null. |
pl.anyHorizontal
Compute the logical OR horizontally across columns.
Kleene logic is used to deal with nulls: if the column contains any null values and no True values, the output is null.
pl.anyHorizontal : exprs: seq<Expr> -> ExprParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<Expr> | Column(s) to use in the aggregation. Accepts expression input. Strings are parsed as column names, other non-expression inputs are parsed as literals. |
pl.arctan2
Compute two argument arctan in radians. Returns the angle (in radians) in the plane between the positive x-axis and the ray from the origin to (x,y).
pl.arctan2 : y: Expr -> x: Expr -> ExprParameters
| Name | Type | Description |
|---|---|---|
y | Expr | - |
x | Expr | - |
pl.argSortBy
Return the row indices that would sort the column(s).
pl.argSortBy : exprs: seq<Expr> -> descending: seq<bool> -> nullsLast: seq<bool> -> multithreaded: bool -> maintainOrder: bool -> ExprParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<Expr> | - |
descending | seq<bool> | Sort in descending order. When sorting by multiple columns, can be specified per column by passing a sequence of booleans. |
nullsLast | seq<bool> | Place null values last. |
multithreaded | bool | Sort using multiple threads. |
maintainOrder | bool | Whether the order should be maintained if elements are equal. |
pl.argWhere
Return indices where condition evaluates True.
pl.argWhere : condition: Expr -> ExprParameters
| Name | Type | Description |
|---|---|---|
condition | Expr | Boolean expression/Series to evaluate |
pl.argWhereAsSeries
Return indices where condition evaluates True and return the result as a Series.
pl.argWhereAsSeries : condition: Expr -> SeriesParameters
| Name | Type | Description |
|---|---|---|
condition | Expr | Boolean expression/Series to evaluate |
pl.array
Array data type.(Also known as fixed length list)
pl.array : inner: DataType -> shape: uint32[] -> DataTypeParameters
| Name | Type | Description |
|---|---|---|
inner | DataType | - |
shape | uint32[] | - |
pl.asLazy
pl.asLazy : df: DataFrame -> LazyFrameParameters
| Name | Type | Description |
|---|---|---|
df | DataFrame | - |
pl.asStruct
Create a Struct expression from a list of expressions.
pl.asStruct : exprs: seq<Expr> -> ExprParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<Expr> | - |
pl.businessDayCount
Count the number of business days between start and end (not including end).
pl.businessDayCount : start: Expr -> endDay: Expr -> weekMask: seq<bool> -> holidays: Series option -> ExprParameters
| Name | Type | Description |
|---|---|---|
start | Expr | Start dates. |
endDay | Expr | End dates. |
weekMask | seq<bool> | Which days of the week to count. The default is Monday to Friday. If you wanted to count only Monday to Thursday, you would pass (True, True, True, True, False, False, False). |
holidays | Series option | Holidays to exclude from the count. |
pl.categorical
Create a Categorical data type with the given categories.
pl.categorical : categories: Categories option -> DataTypeParameters
| Name | Type | Description |
|---|---|---|
categories | Categories option | The categories. |
pl.categories
Create a Categories object with the given name, name space, and physical type.
pl.categories : name: string option -> nameSpace: string option -> physical: CategoricalPhysical option -> CategoriesParameters
| Name | Type | Description |
|---|---|---|
name | string option | The category name. |
nameSpace | string option | The category name space. |
physical | CategoricalPhysical option | The physical type. |
pl.coalesce
(Lazy) Evaluates the arguments in order and returns the first non-null value.
pl.coalesce : exprs: seq<'a> -> ExprParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<'a> | Expressions to evaluate. Strings, Literals, Series are automatically converted. |
Returns: A new expression.
pl.coalesceAsSeries
(Eager) Evaluates the arguments eagerly and returns the first non-null value as a Series.
pl.coalesceAsSeries : exprs: seq<'a> -> SeriesParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<'a> | Expressions or Series to evaluate. |
pl.col
Create an expression representing a column with the given name.
pl.col : name: string -> ExprParameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the column. |
pl.collect
Collect LazyFrame into DataFrame (Eager execution).
pl.collect : lf: LazyFrame -> DataFrameParameters
| Name | Type | Description |
|---|---|---|
lf | LazyFrame | - |
pl.collectAll
Collect multiple LazyFrames concurrently.
pl.collectAll : engine: Engine -> frames: seq<LazyFrame> -> DataFrame[]Parameters
| Name | Type | Description |
|---|---|---|
engine | Engine | - |
frames | seq<LazyFrame> | - |
pl.collectAllAsync
Collect multiple LazyFrames concurrently and asynchronously.
pl.collectAllAsync : engine: Engine -> frames: seq<LazyFrame> -> FSharpAsync<DataFrame[]>Parameters
| Name | Type | Description |
|---|---|---|
engine | Engine | - |
frames | seq<LazyFrame> | - |
pl.collectWithEngine
pl.collectWithEngine : engine: Engine -> lf: LazyFrame -> DataFrameParameters
| Name | Type | Description |
|---|---|---|
engine | Engine | - |
lf | LazyFrame | - |
pl.cols
Create an expression representing multiple columns (Wildcard).
pl.cols : names: seq<string> -> ExprParameters
| Name | Type | Description |
|---|---|---|
names | seq<string> | - |
Example
pl.cols ["A"; "B"]pl.combineDateAndTime
Combine a Date expression and a Time expression into a Datetime expression. Usage: pl.col("date") |> pl.combineDateAndTime (pl.col("time"))
pl.combineDateAndTime : time: Expr -> date: Expr -> ExprParameters
| Name | Type | Description |
|---|---|---|
time | Expr | - |
date | Expr | - |
pl.combineDateAndTimeUnit
Combine a Date expression and a Time expression with a specific TimeUnit. Usage: pl.col("date") |> pl.combineDateAndTimeUnit (pl.col("time")) TimeUnit.Milliseconds
pl.combineDateAndTimeUnit : time: Expr -> tu: TimeUnit -> date: Expr -> ExprParameters
| Name | Type | Description |
|---|---|---|
time | Expr | - |
tu | TimeUnit | - |
date | Expr | - |
pl.concatArray
Combine multiple expressions horizontally into an array element.
pl.concatArray : columns: seq<'a> -> ExprParameters
| Name | Type | Description |
|---|---|---|
columns | seq<'a> | - |
pl.concatDataFrame
Concat DataFrames
pl.concatDataFrame : how: ConcatType -> dfs: seq<DataFrame> -> DataFrameParameters
| Name | Type | Description |
|---|---|---|
how | ConcatType | - |
dfs | seq<DataFrame> | - |
pl.concatExpr
Concat multiple expressions into a single expression.
pl.concatExpr : exprs: seq<'a> -> rechunk: bool -> ExprParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<'a> | - |
rechunk | bool | - |
pl.concatLazyFrame
Concat LazyFrames
pl.concatLazyFrame : how: ConcatType -> lfs: seq<LazyFrame> -> LazyFrameParameters
| Name | Type | Description |
|---|---|---|
how | ConcatType | - |
lfs | seq<LazyFrame> | - |
pl.concatList
Combine multiple expressions horizontally into a List element. Supports Selectors (e.g. pl.concatList([pl.cs.numeric()])).
pl.concatList : columns: seq<'a> -> ExprParameters
| Name | Type | Description |
|---|---|---|
columns | seq<'a> | - |
pl.concatSeries
Concatenates a sequence of Series into a single Series. Preserves caller immutability by creating a cloned accumulator.
pl.concatSeries : series: seq<Series> -> SeriesParameters
| Name | Type | Description |
|---|---|---|
series | seq<Series> | - |
pl.concatString
Horizontally concatenate columns into a single string column.
pl.concatString : exprs: seq<'a> -> separator: string -> ignoreNulls: bool -> ExprParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<'a> | Columns to concatenate into a single string column. |
separator | string | String that will be used to separate the values of each column. |
ignoreNulls | bool | Ignore null values. If set to False, null values will be propagated. if the row contains any null values, the output is null. |
pl.corrPearson
Compute the Pearson’s correlation between two columns.
pl.corrPearson : a: Expr -> b: Expr -> ExprParameters
| Name | Type | Description |
|---|---|---|
a | Expr | Column name or Expression. |
b | Expr | Column name or Expression. |
pl.corrPearsonAsSeries
Compute the Pearson’s correlation between two columns and return the result as a Series.
pl.corrPearsonAsSeries : a: Expr -> b: Expr -> SeriesParameters
| Name | Type | Description |
|---|---|---|
a | Expr | Column name or Expression. |
b | Expr | Column name or Expression. |
pl.corrSpearman
Compute the Spearman rank correlation between two columns.
pl.corrSpearman : a: Expr -> b: Expr -> propagateNans: bool -> ExprParameters
| Name | Type | Description |
|---|---|---|
a | Expr | Column name or Expression. |
b | Expr | Column name or Expression. |
propagateNans | bool | Propagate NaNs. |
pl.corrSpearmanAsSeries
Compute the Spearman rank correlation between two columns and return the result as a Series.
pl.corrSpearmanAsSeries : a: Expr -> b: Expr -> propagateNans: bool -> SeriesParameters
| Name | Type | Description |
|---|---|---|
a | Expr | Column name or Expression. |
b | Expr | Column name or Expression. |
propagateNans | bool | Propagate NaNs. |
pl.count
Return the number of non-null values in the column.
pl.count : names: seq<string> -> ExprParameters
| Name | Type | Description |
|---|---|---|
names | seq<string> | - |
pl.cov
Compute the covariance between two columns/ expressions.
pl.cov : a: Expr -> b: Expr -> ddof: byte -> ExprParameters
| Name | Type | Description |
|---|---|---|
a | Expr | Column name or Expression. |
b | Expr | Column name or Expression. |
ddof | byte | “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. |
pl.covAsSeries
Compute the covariance of two expressions and return the result as a Series.
pl.covAsSeries : a: Expr -> b: Expr -> ddof: byte -> SeriesParameters
| Name | Type | Description |
|---|---|---|
a | Expr | Column name or Expression. |
b | Expr | Column name or Expression. |
ddof | byte | “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. |
pl.cumCount
Return the cumulative count of the non-null values in the column.This function is syntactic sugar for Col(column).CumCount().
pl.cumCount : column: string -> ExprParameters
| Name | Type | Description |
|---|---|---|
column | string | Name of the columns to use. |
pl.cumSum
Cumulatively sum all values. Syntactic sugar for Col(names).CumSum().
pl.cumSum : names: seq<string> -> ExprParameters
| Name | Type | Description |
|---|---|---|
names | seq<string> | - |
pl.dataTypeOf
Gets the DataType of an expression. Equivalent to Python's polars.dtype_of()
pl.dataTypeOf : expr: Expr -> DataTypeExprParameters
| Name | Type | Description |
|---|---|---|
expr | Expr | - |
pl.dataframe
Create a DataFrame from a sequence of Series.
pl.dataframe : series: seq<Series> -> DataFrameParameters
| Name | Type | Description |
|---|---|---|
series | seq<Series> | - |
pl.dateRange
Generate a date range.
pl.dateRange : start: DateOnly -> endRange: DateOnly -> interval: Dur -> closed: ClosedInterval -> ExprParameters
| Name | Type | Description |
|---|---|---|
start | DateOnly | Lower bound of the date range. |
endRange | DateOnly | Upper bound of the date range. |
interval | Dur | Interval of the range periods, “1w2d” # 1 week, 2 days.Default is 1 day. |
closed | ClosedInterval | Define which sides of the range are closed |
Returns: Column of data type Date
pl.dateRangeAsSeries
Generate a date range as a Series.
pl.dateRangeAsSeries : name: string -> start: DateOnly -> endRange: DateOnly -> interval: Dur -> closed: ClosedInterval -> SeriesParameters
| Name | Type | Description |
|---|---|---|
name | string | Name of the series. |
start | DateOnly | Lower bound of the date range. |
endRange | DateOnly | Upper bound of the date range. |
interval | Dur | Interval of the range periods, “1w2d” # 1 week, 2 days.Default is 1 day. |
closed | ClosedInterval | Define which sides of the range are closed |
Returns: Column of data type Date
pl.dateRanges
Create a column of date ranges. DataType will be a list of dates
pl.dateRanges : start: DateOnly -> endRange: DateOnly -> interval: Dur -> closed: ClosedInterval -> ExprParameters
| Name | Type | Description |
|---|---|---|
start | DateOnly | Lower bound of the date range. |
endRange | DateOnly | Upper bound of the date range. |
interval | Dur | Interval of the range periods, “1w2d” # 1 week, 2 days.Default is 1 day. |
closed | ClosedInterval | Define which sides of the range are closed |
Returns: Column of data type Date
pl.dateRangesAsSeries
Generate a date range as a Series.
pl.dateRangesAsSeries : name: string -> start: DateOnly -> endRange: DateOnly -> interval: Dur -> closed: ClosedInterval -> SeriesParameters
| Name | Type | Description |
|---|---|---|
name | string | Name of the series. |
start | DateOnly | Lower bound of the date range. |
endRange | DateOnly | Upper bound of the date range. |
interval | Dur | Interval of the range periods, “1w2d” # 1 week, 2 days.Default is 1 day. |
closed | ClosedInterval | Define which sides of the range are closed |
Returns: Column of data type Date
pl.datetime
Datetime data type.
pl.datetime : unit: TimeUnit -> timeZone: string option -> DataTypeParameters
| Name | Type | Description |
|---|---|---|
unit | TimeUnit | - |
timeZone | string option | - |
pl.datetimeRange
Generate a datetime range.
pl.datetimeRange : start: DateTime -> endRange: DateTime -> interval: Dur -> closed: ClosedInterval -> unit: TimeUnit -> timeZone: string option -> ExprParameters
| Name | Type | Description |
|---|---|---|
start | DateTime | Lower bound of the datetime range. |
endRange | DateTime | Upper bound of the datetime range. |
interval | Dur | Interval of the range periods |
closed | ClosedInterval | Define which sides of the range are closed |
unit | TimeUnit | Time unit of the resulting Datetime data type. |
timeZone | string option | Time zone of the resulting Datetime data type. |
pl.datetimeRangeAsSeries
Converts a datetime range expression to a Series with the specified name.
pl.datetimeRangeAsSeries : name: string -> start: DateTime -> endRange: DateTime -> interval: Dur -> closed: ClosedInterval -> unit: TimeUnit -> timeZone: string option -> SeriesParameters
| Name | Type | Description |
|---|---|---|
name | string | Name of the resulting Series. |
start | DateTime | Start datetime of the range. |
endRange | DateTime | End datetime of the range. |
interval | Dur | Interval between datetime values. |
closed | ClosedInterval | Closed window of the range. |
unit | TimeUnit | Time unit of the resulting Datetime data type. |
timeZone | string option | Time zone of the resulting Datetime data type. |
pl.datetimeRanges
Creates a datetime range expression from the specified start, end, interval, closed window, unit, and time zone.
pl.datetimeRanges : start: DateTime -> endRange: DateTime -> interval: Dur -> closed: ClosedInterval -> unit: TimeUnit -> timeZone: string option -> ExprParameters
| Name | Type | Description |
|---|---|---|
start | DateTime | - |
endRange | DateTime | - |
interval | Dur | - |
closed | ClosedInterval | - |
unit | TimeUnit | - |
timeZone | string option | - |
pl.datetimeRangesAsSeries
Converts a datetime range expression to a Series with the specified name.
pl.datetimeRangesAsSeries : name: string -> start: DateTime -> endRange: DateTime -> interval: Dur -> closed: ClosedInterval -> unit: TimeUnit -> timeZone: string option -> SeriesParameters
| Name | Type | Description |
|---|---|---|
name | string | - |
start | DateTime | - |
endRange | DateTime | - |
interval | Dur | - |
closed | ClosedInterval | - |
unit | TimeUnit | - |
timeZone | string option | - |
pl.decimal
Decimal data type.
pl.decimal : precision: int -> scale: int -> DataTypeParameters
| Name | Type | Description |
|---|---|---|
precision | int | - |
scale | int | - |
pl.duration
Duration (TimeSpan) data type.
pl.duration : unit: TimeUnit -> DataTypeParameters
| Name | Type | Description |
|---|---|---|
unit | TimeUnit | - |
pl.enumType
Create an Enum data type with the given categories.
pl.enumType : categories: Categories -> DataTypeParameters
| Name | Type | Description |
|---|---|---|
categories | Categories | The categories. |
pl.escapeRegex
Escapes string regex meta characters.
pl.escapeRegex : s: string -> stringParameters
| Name | Type | Description |
|---|---|---|
s | string | The string to escape. |
Returns: A string with regex meta characters escaped.
pl.excludeCols
Represent all columns except for the given columns. Syntactic sugar for pl.all().Exclude(columns).
pl.excludeCols : columns: seq<string> -> ExprParameters
| Name | Type | Description |
|---|---|---|
columns | seq<string> | - |
pl.excludeDataTypes
Represent all columns except for the given datatypes. Syntactic sugar for pl.all().Exclude(dtypes).
pl.excludeDataTypes : dtypes: seq<DataType> -> ExprParameters
| Name | Type | Description |
|---|---|---|
dtypes | seq<DataType> | - |
pl.explainAll
Explain multiple LazyFrames as if passed to collect_all. Common Subplan Elimination is applied on the combined plan, meaning that diverging queries will run only once.
pl.explainAll : lazyFrames: seq<LazyFrame> -> stringParameters
| Name | Type | Description |
|---|---|---|
lazyFrames | seq<LazyFrame> | A list of LazyFrames to collect. |
Returns: Explained plan.
pl.extensionType
Create an Extension data type
pl.extensionType : name: string -> inner: DataType -> metadata: string option -> DataTypeParameters
| Name | Type | Description |
|---|---|---|
name | string | The registered name of the extension type (e.g. "geoarrow.wkb") |
inner | DataType | The physical storage data type |
metadata | string option | Optional metadata string |
pl.field
Create a Struct Field with the given name and data type.
pl.field : name: string -> dtype: DataType -> FieldParameters
| Name | Type | Description |
|---|---|---|
name | string | The field name. |
dtype | DataType | The data type. |
pl.firstCol
Get the first column.
pl.firstCol : unit -> Selectorpl.firstValue
Get the first value of the group/series.
pl.firstValue : columns: seq<string> -> (unit -> Expr)Parameters
| Name | Type | Description |
|---|---|---|
columns | seq<string> | - |
Returns: A new expression representing the first value.
pl.fold
Accumulate over multiple columns horizontally/row-wise.
pl.fold : f: (Expr -> (Expr -> Expr)) -> acc: Expr -> exprs: seq<Expr> -> ExprParameters
| Name | Type | Description |
|---|---|---|
f | (Expr -> (Expr -> Expr)) | - |
acc | Expr | - |
exprs | seq<Expr> | - |
pl.format
Format expressions as a string.
pl.format : format: string -> exprs: seq<'a> -> ExprParameters
| Name | Type | Description |
|---|---|---|
format | string | - |
exprs | seq<'a> | - |
pl.fromEpoch
Parses an integer column (seconds, milliseconds, etc.) into a Datetime or Date expression.
pl.fromEpoch : column: Expr -> timeUnit: EpochTimeUnit -> ExprParameters
| Name | Type | Description |
|---|---|---|
column | Expr | - |
timeUnit | EpochTimeUnit | - |
pl.ifElse
Create an if-else expression.
pl.ifElse : predicate: Expr -> ifTrue: Expr -> ifFalse: Expr -> ExprParameters
| Name | Type | Description |
|---|---|---|
predicate | Expr | - |
ifTrue | Expr | - |
ifFalse | Expr | - |
pl.implode
Aggregate all column values into a list. This function is syntactic sugar for pl.col(name).Implode().
pl.implode : column: string -> ExprParameters
| Name | Type | Description |
|---|---|---|
column | string | Column name |
pl.intRange
Generate a range of integers as an Expression.
pl.intRange : start: int64 -> endRange: int64 -> step: int64 -> ExprParameters
| Name | Type | Description |
|---|---|---|
start | int64 | Start of the range (inclusive). |
endRange | int64 | End of the range (exclusive). |
step | int64 | Step size of the range. |
Returns: A Literal Expression containing the integer series.
pl.intRangeAsSeries
Generate a range of integers as a Series.
pl.intRangeAsSeries : name: string -> start: int64 -> endRange: int64 -> step: int64 -> SeriesParameters
| Name | Type | Description |
|---|---|---|
name | string | Name of the series. |
start | int64 | Start of the range (inclusive). |
endRange | int64 | End of the range (exclusive). |
step | int64 | Step size of the range. |
Returns: A Series containing the integer series.
pl.intRanges
Generate a range of integers for each row of the input columns. Resulting column is of dtype List(dtype).
pl.intRanges : start: int64 -> endRange: int64 -> step: int64 -> ExprParameters
| Name | Type | Description |
|---|---|---|
start | int64 | - |
endRange | int64 | - |
step | int64 | - |
pl.intRangesAsSeries
pl.intRangesAsSeries : name: string -> start: int64 -> endRange: int64 -> step: int64 -> SeriesParameters
| Name | Type | Description |
|---|---|---|
name | string | - |
start | int64 | - |
endRange | int64 | - |
step | int64 | - |
pl.lastCol
Get the last column.
pl.lastCol : unit -> Selectorpl.lastValue
Get the last value of the group/series.
pl.lastValue : columns: seq<string> -> (unit -> Expr)Parameters
| Name | Type | Description |
|---|---|---|
columns | seq<string> | - |
Returns: A new expression representing the first value.
pl.len
Return the lines count of current context.
pl.len : unit -> Exprpl.linearSpace
Generate a series of equally-spaced points.
pl.linearSpace : start: Expr -> endRange: Expr -> numSamples: int -> closed: ClosedInterval -> ExprParameters
| Name | Type | Description |
|---|---|---|
start | Expr | Lower bound of the linear space. |
endRange | Expr | Upper bound of the linear space. |
numSamples | int | Number of samples to generate. |
closed | ClosedInterval | Whether the intervals are closed or open. |
pl.linearSpaceAsSeries
Converts a linear space expression to a Series with the specified name.
pl.linearSpaceAsSeries : name: string -> start: Expr -> endRange: Expr -> numSamples: int -> closed: ClosedInterval -> SeriesParameters
| Name | Type | Description |
|---|---|---|
name | string | Name of the resulting Series. |
start | Expr | Lower bound of the linear space. |
endRange | Expr | Upper bound of the linear space. |
numSamples | int | Number of samples to generate. |
closed | ClosedInterval | Whether the intervals are closed or open. |
pl.linearSpaces
Create a column of linearly-spaced sequences for each row.
pl.linearSpaces : start: Expr -> endRange: Expr -> numSamples: int -> closed: ClosedInterval -> asArray: bool -> ExprParameters
| Name | Type | Description |
|---|---|---|
start | Expr | Lower bound. |
endRange | Expr | Upper bound. |
numSamples | int | Number of samples. |
closed | ClosedInterval | Whether the intervals are closed or open. |
asArray | bool | If true, returns an Array dtype instead of List. Requires numSamples to be a constant. |
pl.linearSpacesAsSeries
Converts a linear spaces expression to a Series with the specified name.
pl.linearSpacesAsSeries : name: string -> start: Expr -> endRange: Expr -> numSamples: int -> closed: ClosedInterval -> asArray: bool -> SeriesParameters
| Name | Type | Description |
|---|---|---|
name | string | Name of the resulting Series. |
start | Expr | Lower bound. |
endRange | Expr | Upper bound. |
numSamples | int | Number of samples. |
closed | ClosedInterval | Whether the intervals are closed or open. |
asArray | bool | If true, returns an Array dtype instead of List. Requires numSamples to be a constant. |
pl.list
List data type.
pl.list : inner: DataType -> DataTypeParameters
| Name | Type | Description |
|---|---|---|
inner | DataType | - |
pl.lit
Create a literal expression from a value.
pl.lit : value: 'T -> ExprParameters
| Name | Type | Description |
|---|---|---|
value | 'T | - |
Example
df.Filter(pl.col("Age") .> pl.lit(18))pl.lit$W
pl.lit$W : op_Dollar: (LitMechanism -> ('T -> Expr)) -> value: 'T -> ExprParameters
| Name | Type | Description |
|---|---|---|
op_Dollar | (LitMechanism -> ('T -> Expr)) | - |
value | 'T | - |
pl.litBinary
Creates a scalar Binary Literal Expression from a byte array.
pl.litBinary : value: byte[] -> ExprParameters
| Name | Type | Description |
|---|---|---|
value | byte[] | - |
pl.litNull
Create a literal expression for null value.
pl.litNull : unit -> Exprpl.litSeries
Create a literal expression from a Series.
pl.litSeries : series: Series -> ExprParameters
| Name | Type | Description |
|---|---|---|
series | Series | - |
pl.litStruct
Create a Struct Expression from a single anonymous record or class instance.
Example: pl.litStruct {| A = 1; B = "hi" |}
pl.litStruct : value: 'T -> ExprParameters
| Name | Type | Description |
|---|---|---|
value | 'T | The object to pack into a struct. |
pl.litStructs
Create a Struct Expression from a sequence of objects.
The properties of the objects become the fields of the struct.
pl.litStructs : values: seq<'T> -> ExprParameters
| Name | Type | Description |
|---|---|---|
values | seq<'T> | The sequence of objects to pack. |
pl.max
Get the maximum value. Syntactic sugar for Col(names).Max().
pl.max : names: seq<string> -> ExprParameters
| Name | Type | Description |
|---|---|---|
names | seq<string> | Name(s) of the columns to use in the aggregation. |
pl.maxHorizontal
Get the maximum value horizontally across columns.
pl.maxHorizontal : exprs: seq<Expr> -> ExprParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<Expr> | Column(s) to use in the aggregation. |
pl.mean
Get the Mean value. Syntactic sugar for Col(names).Mean().
pl.mean : names: seq<string> -> ExprParameters
| Name | Type | Description |
|---|---|---|
names | seq<string> | Name(s) of the columns to use in the aggregation. |
pl.meanHorizontal
Compute the mean of all values horizontally across columns.
pl.meanHorizontal : exprs: seq<Expr> -> ignoreNulls: bool -> ExprParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<Expr> | Column(s) to use in the aggregation. Accepts expression input. Strings are parsed as column names, other non-expression inputs are parsed as literals. |
ignoreNulls | bool | Ignore null values (default). If set to False, any null value in the input will lead to a null output. |
pl.median
Get the median value.This function is syntactic sugar for Pl.Col(columns).Median().
pl.median : names: seq<string> -> ExprParameters
| Name | Type | Description |
|---|---|---|
names | seq<string> | One or more column names. |
pl.nUnique
Count unique values.This function is syntactic sugar for pl.col(columns).NUnique().
pl.nUnique : names: seq<string> -> ExprParameters
| Name | Type | Description |
|---|---|---|
names | seq<string> | - |
pl.nth
Get the nth column(s) of the context.
pl.nth : indices: seq<int64> -> SelectorParameters
| Name | Type | Description |
|---|---|---|
indices | seq<int64> | One or more indices representing the columns to retrieve. |
pl.ones
Construct a column of length n filled with ones. This is syntactic sugar for the repeat function.
pl.ones : n: int -> ExprParameters
| Name | Type | Description |
|---|---|---|
n | int | Length of the resulting column. |
pl.onesAsSeries
pl.onesAsSeries : n: int -> SeriesParameters
| Name | Type | Description |
|---|---|---|
n | int | - |
pl.otherwise
Terminal operator that provides the default fallback expression for a when-then-otherwise chain.
pl.otherwise : fallback: Expr -> thenBlock: ThenBranch -> ExprParameters
| Name | Type | Description |
|---|---|---|
fallback | Expr | The fallback expression. |
thenBlock | ThenBranch | The ThenBranch collector block. |
Returns: The compiled ternary expression tree.
pl.quantile
Syntactic sugar for pl.Col("foo").Quantile(..).
pl.quantile : column: string -> quantile: float -> interpolation: QuantileMethod -> ExprParameters
| Name | Type | Description |
|---|---|---|
column | string | Column name. |
quantile | float | Quantile between 0.0 and 1.0. |
interpolation | QuantileMethod | Interpolation method. |
pl.reduce
Reduce multiple columns horizontally/row-wise.
pl.reduce : f: (Expr -> (Expr -> Expr)) -> exprs: seq<Expr> -> ExprParameters
| Name | Type | Description |
|---|---|---|
f | (Expr -> (Expr -> Expr)) | - |
exprs | seq<Expr> | - |
pl.registerExtensionAsStorage
Register the extension type to be passed through purely as physical storage.
pl.registerExtensionAsStorage : extName: string -> unitParameters
| Name | Type | Description |
|---|---|---|
extName | string | The registered name. |
pl.registerExtensionType
Register the extension type for the given extension name.
pl.registerExtensionType : extName: string -> factory: ((DataType * string option) -> DataType) -> unitParameters
| Name | Type | Description |
|---|---|---|
extName | string | The registered name. |
factory | ((DataType * string option) -> DataType) | The factory function deserialize the extension type. |
pl.repeat
Construct a column of length n filled with the given value.
pl.repeat : value: Expr -> n: int -> dtype: DataType option -> ExprParameters
| Name | Type | Description |
|---|---|---|
value | Expr | Value to repeat. |
n | int | Length of the resulting column. |
dtype | DataType option | Data type of the resulting column. If set to None (default), data type is inferred from the given value. Defaults to Int32 for integer values, unless Int64 is required to fit the given value. Defaults to Float64 for float values. |
pl.repeatAsSeries
pl.repeatAsSeries : value: Expr -> n: int -> dtype: DataType option -> SeriesParameters
| Name | Type | Description |
|---|---|---|
value | Expr | - |
n | int | - |
dtype | DataType option | - |
pl.rollingCorr
Compute the rolling correlation between two columns/ expressions. The window at a given row includes the row itself and the window_size - 1 elements before it.
pl.rollingCorr : a: Expr -> b: Expr -> windowSize: uint32 -> minSamples: uint32 option -> ExprParameters
| Name | Type | Description |
|---|---|---|
a | Expr | Column name or Expression. |
b | Expr | Column name or Expression. |
windowSize | uint32 | The length of the window. |
minSamples | uint32 option | The number of values in the window that should be non-null before computing a result. If None, it will be set equal to window size. |
pl.rollingCov
Compute the rolling covariance between two columns/ expressions. The window at a given row includes the row itself and the window_size - 1 elements before it.
pl.rollingCov : a: Expr -> b: Expr -> windowSize: uint32 -> minSamples: uint32 option -> ddof: byte -> ExprParameters
| Name | Type | Description |
|---|---|---|
a | Expr | Column name or Expression. |
b | Expr | Column name or Expression. |
windowSize | uint32 | The length of the window. |
minSamples | uint32 option | The number of values in the window that should be non-null before computing a result. If None, it will be set equal to window size. |
ddof | byte | Delta degrees of freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. |
pl.schema
Create a schema from a sequence of fields.
pl.schema : fields: seq<Field> -> PolarsSchemaParameters
| Name | Type | Description |
|---|---|---|
fields | seq<Field> | - |
pl.selectExprsEager
Run polars expressions without a context. This is syntactic sugar for running df.select on an empty DataFrame.
pl.selectExprsEager : exprs: seq<Expr> -> DataFrameParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<Expr> | - |
pl.selectExprsLazy
Run polars expressions without a context. This is syntactic sugar for running lf.select on an empty LazyFrame.
pl.selectExprsLazy : exprs: seq<Expr> -> LazyFrameParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<Expr> | - |
pl.selfDataType
Represents the intrinsic data type of the current element. Equivalent to Python's polars.self_dtype()
pl.selfDataType : unit -> DataTypeExprpl.series
Create a Series from a sequence of values.
pl.series : name: string -> data: seq<'T> -> SeriesParameters
| Name | Type | Description |
|---|---|---|
name | string | - |
data | seq<'T> | - |
pl.setEnvVar
Set environment variable.
pl.setEnvVar : key: string -> value: string -> unitParameters
| Name | Type | Description |
|---|---|---|
key | string | - |
value | string | - |
pl.sqlContext
Create a SQL context for executing SQL queries on LazyFrames.
pl.sqlContext : unit -> SqlContextpl.sqlExpr
Create a Polars Expr from a SQL string.
pl.sqlExpr : sql: string -> ExprParameters
| Name | Type | Description |
|---|---|---|
sql | string | The SQL expression string. |
Returns: A Polars Expr representing the SQL logic.
pl.sqlExprs
Create an array of Polars Exprs from a collection of SQL strings.
pl.sqlExprs : sqls: seq<string> -> Expr[]Parameters
| Name | Type | Description |
|---|---|---|
sqls | seq<string> | The collection of SQL expression strings. |
Returns: An array of Polars Expr objects.
pl.std
Get the standard deviation. This function is syntactic sugar for pl.col(column).Std(ddof).
pl.std : column: string -> ddof: byte -> ExprParameters
| Name | Type | Description |
|---|---|---|
column | string | Column name. |
ddof | byte | “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. |
pl.structSeries
Collect several expressions and combine them into a single Struct Series
pl.structSeries : exprs: seq<Expr> -> SeriesParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<Expr> | - |
pl.structType
Struct data type.
pl.structType : fields: seq<Field> -> DataTypeParameters
| Name | Type | Description |
|---|---|---|
fields | seq<Field> | - |
pl.sum
Get the Sum value. Syntactic sugar for Col(names).Sum().
pl.sum : names: seq<string> -> ExprParameters
| Name | Type | Description |
|---|---|---|
names | seq<string> | Name(s) of the columns to use in the aggregation. |
pl.sumHorizontal
Sum all values horizontally across columns.
pl.sumHorizontal : exprs: seq<Expr> -> ignoreNulls: bool -> ExprParameters
| Name | Type | Description |
|---|---|---|
exprs | seq<Expr> | An iterable of expressions |
ignoreNulls | bool | Whether to ignore null values |
pl.then'
Connects a statement expression to the preceding when' condition.
pl.then' : statement: Expr -> whenBlock: WhenCondition -> ThenBranchParameters
| Name | Type | Description |
|---|---|---|
statement | Expr | The expression to evaluate if the condition is true. |
whenBlock | WhenCondition | The WhenCondition block built by pl.when'. |
Returns: A new ThenBranch collector block.
pl.threadPoolSize
Get thread pool size.
pl.threadPoolSize : unit -> intpl.timeRange
Generate a time range.
pl.timeRange : start: TimeOnly -> endRange: TimeOnly -> interval: Dur -> closed: ClosedInterval -> ExprParameters
| Name | Type | Description |
|---|---|---|
start | TimeOnly | Lower bound of the time range. If omitted, defaults to TimeOnly.MinValue |
endRange | TimeOnly | - |
interval | Dur | Interval of the range periods |
closed | ClosedInterval | Define which sides of the range are closed. |
pl.timeRangeAsSeries
Converts a time range expression to a Series with the specified name.
pl.timeRangeAsSeries : name: string -> start: TimeOnly -> endRange: TimeOnly -> interval: Dur -> closed: ClosedInterval -> SeriesParameters
| Name | Type | Description |
|---|---|---|
name | string | Name of the resulting Series. |
start | TimeOnly | Start time of the range. |
endRange | TimeOnly | End time of the range. |
interval | Dur | Interval between time values. |
closed | ClosedInterval | Closed window of the range. |
pl.timeRanges
Creates a time range expression from the specified start, end, interval, and closed window.
pl.timeRanges : start: TimeOnly -> endRange: TimeOnly -> interval: Dur -> closed: ClosedInterval -> ExprParameters
| Name | Type | Description |
|---|---|---|
start | TimeOnly | Start time of the range. |
endRange | TimeOnly | End time of the range. |
interval | Dur | Interval between time values. |
closed | ClosedInterval | Closed window of the range. |
pl.timeRangesAsSeries
Converts a time range expression to a Series with the specified name.
pl.timeRangesAsSeries : name: string -> start: TimeOnly -> endRange: TimeOnly -> interval: Dur -> closed: ClosedInterval -> SeriesParameters
| Name | Type | Description |
|---|---|---|
name | string | Name of the resulting Series. |
start | TimeOnly | Start time of the range. |
endRange | TimeOnly | End time of the range. |
interval | Dur | Interval between time values. |
closed | ClosedInterval | Closed window of the range. |
pl.tryGetExtensionType
Get the extension type registration info for the given extension name.
pl.tryGetExtensionType : extName: string -> ExtensionRegistration optionParameters
| Name | Type | Description |
|---|---|---|
extName | string | The registered name. |
pl.unregisterExtensionType
Unregister the extension type for the given extension name.
pl.unregisterExtensionType : extName: string -> unitParameters
| Name | Type | Description |
|---|---|---|
extName | string | The registered name. |
pl.var
Get the variance. This function is syntactic sugar for Pl.Col(column).Var(ddof).
pl.var : column: string -> ddof: byte -> ExprParameters
| Name | Type | Description |
|---|---|---|
column | string | Column name. |
ddof | byte | “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. |
pl.when'
Starts a conditional when-then-otherwise expression branch natively in F#.
pl.when' : condition: Expr -> WhenConditionParameters
| Name | Type | Description |
|---|---|---|
condition | Expr | The initial filter condition expression. |
Returns: An intermediate WhenCondition state object.
pl.zeros
Construct a column of length n filled with zeros. This is syntactic sugar for the repeat function.
pl.zeros : n: int -> ExprParameters
| Name | Type | Description |
|---|---|---|
n | int | Length of the resulting column. |
pl.zerosAsSeries
pl.zerosAsSeries : n: int -> SeriesParameters
| Name | Type | Description |
|---|---|---|
n | int | - |