Skip to content

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 ​

PropertyTypeDescription
booleanDataTypeBoolean data type.
dateDataTypeDate data type (no time).
elementExprAlias for an element being evaluated in an eval or filter expression.
emptySchemaPolarsSchemaCreate an empty schema.
float16DataType16-bit Floating point data type.
float32DataType32-bit Floating point data type.
float64DataType64-bit Floating point data type.
int128DataType128-bit Integer data type.
int16DataType16-bit Integer data type.
int32DataType32-bit Integer data type.
int64DataType64-bit Integer data type.
int8DataType8-bit Integer data type.
nullTypeDataTypeCreate a Null data type.
sameAsInputTypeDataTypeCreate a SameAsInputType data type.
stringDataTypeString data type (UTF-8).
timeDataTypeTime data type (no date).
uint16DataType16-bit Unsigned Integer data type.
uint32DataType32-bit Unsigned Integer data type.
uint64DataType64-bit Unsigned Integer data type.
uint8DataType8-bit Unsigned Integer data type.
unknownTypeDataTypeCreate an Unknown data type.(Same as SameAsInputType)
utf8DataTypealias of String

Module Functions ​

pl.alias ​

Alias an expression with a new name.

fsharp
pl.alias : name: string -> expr: Expr -> Expr

Parameters

NameTypeDescription
namestring-
exprExpr-

pl.alignDataFrames ​

Align a sequence of DataFrames on a common schema.

fsharp
pl.alignDataFrames : on: seq<Expr> -> how: JoinType -> select: seq<Expr> option -> descending: bool -> frames: seq<DataFrame> -> DataFrame[]

Parameters

NameTypeDescription
onseq<Expr>-
howJoinType-
selectseq<Expr> option-
descendingbool-
framesseq<DataFrame>-

pl.alignDataFramesAsync ​

Align a sequence of DataFrames on a common schema asynchronously.

fsharp
pl.alignDataFramesAsync : on: seq<Expr> -> how: JoinType -> select: seq<Expr> option -> descending: bool -> frames: seq<DataFrame> -> FSharpAsync<DataFrame[]>

Parameters

NameTypeDescription
onseq<Expr>-
howJoinType-
selectseq<Expr> option-
descendingbool-
framesseq<DataFrame>-

pl.alignLazyFrames ​

Align a sequence of frames using common values from one or more columns as a key.

fsharp
pl.alignLazyFrames : on: seq<Expr> -> how: JoinType -> select: seq<Expr> option -> descending: bool -> frames: seq<LazyFrame> -> LazyFrame[]

Parameters

NameTypeDescription
onseq<Expr>One or more columns whose unique values will be used to align the frames.
howJoinTypeJoin strategy; defaults to outer join.
selectseq<Expr> optionOptional post-alignment column select.
descendingboolSort the alignment column values in descending order.
framesseq<LazyFrame>Sequence of DataFrames or LazyFrames.

pl.all ​

Select all columns. Equivalent to pl.col("*").

fsharp
pl.all : unit -> Expr

pl.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.

fsharp
pl.allHorizontal : exprs: seq<Expr> -> Expr

Parameters

NameTypeDescription
exprsseq<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().

fsharp
pl.allOf : names: seq<string> -> ignoreNulls: bool -> Expr

Parameters

NameTypeDescription
namesseq<string>The names of the columns to aggregate.
ignoreNullsboolIf 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.

fsharp
pl.any : exprs: seq<string> -> ignoreNulls: bool -> Expr

Parameters

NameTypeDescription
exprsseq<string>Column(s) to use in aggregation.
ignoreNullsboolIf 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.

fsharp
pl.anyHorizontal : exprs: seq<Expr> -> Expr

Parameters

NameTypeDescription
exprsseq<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).

fsharp
pl.arctan2 : y: Expr -> x: Expr -> Expr

Parameters

NameTypeDescription
yExpr-
xExpr-

pl.argSortBy ​

Return the row indices that would sort the column(s).

fsharp
pl.argSortBy : exprs: seq<Expr> -> descending: seq<bool> -> nullsLast: seq<bool> -> multithreaded: bool -> maintainOrder: bool -> Expr

Parameters

NameTypeDescription
exprsseq<Expr>-
descendingseq<bool>Sort in descending order. When sorting by multiple columns, can be specified per column by passing a sequence of booleans.
nullsLastseq<bool>Place null values last.
multithreadedboolSort using multiple threads.
maintainOrderboolWhether the order should be maintained if elements are equal.

pl.argWhere ​

Return indices where condition evaluates True.

fsharp
pl.argWhere : condition: Expr -> Expr

Parameters

NameTypeDescription
conditionExprBoolean expression/Series to evaluate

pl.argWhereAsSeries ​

Return indices where condition evaluates True and return the result as a Series.

fsharp
pl.argWhereAsSeries : condition: Expr -> Series

Parameters

NameTypeDescription
conditionExprBoolean expression/Series to evaluate

pl.array ​

Array data type.(Also known as fixed length list)

fsharp
pl.array : inner: DataType -> shape: uint32[] -> DataType

Parameters

NameTypeDescription
innerDataType-
shapeuint32[]-

pl.asLazy ​

fsharp
pl.asLazy : df: DataFrame -> LazyFrame

Parameters

NameTypeDescription
dfDataFrame-

pl.asStruct ​

Create a Struct expression from a list of expressions.

fsharp
pl.asStruct : exprs: seq<Expr> -> Expr

Parameters

NameTypeDescription
exprsseq<Expr>-

pl.businessDayCount ​

Count the number of business days between start and end (not including end).

fsharp
pl.businessDayCount : start: Expr -> endDay: Expr -> weekMask: seq<bool> -> holidays: Series option -> Expr

Parameters

NameTypeDescription
startExprStart dates.
endDayExprEnd dates.
weekMaskseq<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).
holidaysSeries optionHolidays to exclude from the count.

pl.categorical ​

Create a Categorical data type with the given categories.

fsharp
pl.categorical : categories: Categories option -> DataType

Parameters

NameTypeDescription
categoriesCategories optionThe categories.

pl.categories ​

Create a Categories object with the given name, name space, and physical type.

fsharp
pl.categories : name: string option -> nameSpace: string option -> physical: CategoricalPhysical option -> Categories

Parameters

NameTypeDescription
namestring optionThe category name.
nameSpacestring optionThe category name space.
physicalCategoricalPhysical optionThe physical type.

pl.coalesce ​

(Lazy) Evaluates the arguments in order and returns the first non-null value.

fsharp
pl.coalesce : exprs: seq<'a> -> Expr

Parameters

NameTypeDescription
exprsseq<'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.

fsharp
pl.coalesceAsSeries : exprs: seq<'a> -> Series

Parameters

NameTypeDescription
exprsseq<'a>Expressions or Series to evaluate.

pl.col ​

Create an expression representing a column with the given name.

fsharp
pl.col : name: string -> Expr

Parameters

NameTypeDescription
namestringThe name of the column.

pl.collect ​

Collect LazyFrame into DataFrame (Eager execution).

fsharp
pl.collect : lf: LazyFrame -> DataFrame

Parameters

NameTypeDescription
lfLazyFrame-

pl.collectAll ​

Collect multiple LazyFrames concurrently.

fsharp
pl.collectAll : engine: Engine -> frames: seq<LazyFrame> -> DataFrame[]

Parameters

NameTypeDescription
engineEngine-
framesseq<LazyFrame>-

pl.collectAllAsync ​

Collect multiple LazyFrames concurrently and asynchronously.

fsharp
pl.collectAllAsync : engine: Engine -> frames: seq<LazyFrame> -> FSharpAsync<DataFrame[]>

Parameters

NameTypeDescription
engineEngine-
framesseq<LazyFrame>-

pl.collectWithEngine ​

fsharp
pl.collectWithEngine : engine: Engine -> lf: LazyFrame -> DataFrame

Parameters

NameTypeDescription
engineEngine-
lfLazyFrame-

pl.cols ​

Create an expression representing multiple columns (Wildcard).

fsharp
pl.cols : names: seq<string> -> Expr

Parameters

NameTypeDescription
namesseq<string>-

Example

fsharp
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"))

fsharp
pl.combineDateAndTime : time: Expr -> date: Expr -> Expr

Parameters

NameTypeDescription
timeExpr-
dateExpr-

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

fsharp
pl.combineDateAndTimeUnit : time: Expr -> tu: TimeUnit -> date: Expr -> Expr

Parameters

NameTypeDescription
timeExpr-
tuTimeUnit-
dateExpr-

pl.concatArray ​

Combine multiple expressions horizontally into an array element.

fsharp
pl.concatArray : columns: seq<'a> -> Expr

Parameters

NameTypeDescription
columnsseq<'a>-

pl.concatDataFrame ​

Concat DataFrames

fsharp
pl.concatDataFrame : how: ConcatType -> dfs: seq<DataFrame> -> DataFrame

Parameters

NameTypeDescription
howConcatType-
dfsseq<DataFrame>-

pl.concatExpr ​

Concat multiple expressions into a single expression.

fsharp
pl.concatExpr : exprs: seq<'a> -> rechunk: bool -> Expr

Parameters

NameTypeDescription
exprsseq<'a>-
rechunkbool-

pl.concatLazyFrame ​

Concat LazyFrames

fsharp
pl.concatLazyFrame : how: ConcatType -> lfs: seq<LazyFrame> -> LazyFrame

Parameters

NameTypeDescription
howConcatType-
lfsseq<LazyFrame>-

pl.concatList ​

Combine multiple expressions horizontally into a List element. Supports Selectors (e.g. pl.concatList([pl.cs.numeric()])).

fsharp
pl.concatList : columns: seq<'a> -> Expr

Parameters

NameTypeDescription
columnsseq<'a>-

pl.concatSeries ​

Concatenates a sequence of Series into a single Series. Preserves caller immutability by creating a cloned accumulator.

fsharp
pl.concatSeries : series: seq<Series> -> Series

Parameters

NameTypeDescription
seriesseq<Series>-

pl.concatString ​

Horizontally concatenate columns into a single string column.

fsharp
pl.concatString : exprs: seq<'a> -> separator: string -> ignoreNulls: bool -> Expr

Parameters

NameTypeDescription
exprsseq<'a>Columns to concatenate into a single string column.
separatorstringString that will be used to separate the values of each column.
ignoreNullsboolIgnore 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.

fsharp
pl.corrPearson : a: Expr -> b: Expr -> Expr

Parameters

NameTypeDescription
aExprColumn name or Expression.
bExprColumn name or Expression.

pl.corrPearsonAsSeries ​

Compute the Pearson’s correlation between two columns and return the result as a Series.

fsharp
pl.corrPearsonAsSeries : a: Expr -> b: Expr -> Series

Parameters

NameTypeDescription
aExprColumn name or Expression.
bExprColumn name or Expression.

pl.corrSpearman ​

Compute the Spearman rank correlation between two columns.

fsharp
pl.corrSpearman : a: Expr -> b: Expr -> propagateNans: bool -> Expr

Parameters

NameTypeDescription
aExprColumn name or Expression.
bExprColumn name or Expression.
propagateNansboolPropagate NaNs.

pl.corrSpearmanAsSeries ​

Compute the Spearman rank correlation between two columns and return the result as a Series.

fsharp
pl.corrSpearmanAsSeries : a: Expr -> b: Expr -> propagateNans: bool -> Series

Parameters

NameTypeDescription
aExprColumn name or Expression.
bExprColumn name or Expression.
propagateNansboolPropagate NaNs.

pl.count ​

Return the number of non-null values in the column.

fsharp
pl.count : names: seq<string> -> Expr

Parameters

NameTypeDescription
namesseq<string>-

pl.cov ​

Compute the covariance between two columns/ expressions.

fsharp
pl.cov : a: Expr -> b: Expr -> ddof: byte -> Expr

Parameters

NameTypeDescription
aExprColumn name or Expression.
bExprColumn name or Expression.
ddofbyte“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.

fsharp
pl.covAsSeries : a: Expr -> b: Expr -> ddof: byte -> Series

Parameters

NameTypeDescription
aExprColumn name or Expression.
bExprColumn name or Expression.
ddofbyte“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().

fsharp
pl.cumCount : column: string -> Expr

Parameters

NameTypeDescription
columnstringName of the columns to use.

pl.cumSum ​

Cumulatively sum all values. Syntactic sugar for Col(names).CumSum().

fsharp
pl.cumSum : names: seq<string> -> Expr

Parameters

NameTypeDescription
namesseq<string>-

pl.dataTypeOf ​

Gets the DataType of an expression. Equivalent to Python's polars.dtype_of()

fsharp
pl.dataTypeOf : expr: Expr -> DataTypeExpr

Parameters

NameTypeDescription
exprExpr-

pl.dataframe ​

Create a DataFrame from a sequence of Series.

fsharp
pl.dataframe : series: seq<Series> -> DataFrame

Parameters

NameTypeDescription
seriesseq<Series>-

pl.dateRange ​

Generate a date range.

fsharp
pl.dateRange : start: DateOnly -> endRange: DateOnly -> interval: Dur -> closed: ClosedInterval -> Expr

Parameters

NameTypeDescription
startDateOnlyLower bound of the date range.
endRangeDateOnlyUpper bound of the date range.
intervalDurInterval of the range periods, “1w2d” # 1 week, 2 days.Default is 1 day.
closedClosedIntervalDefine which sides of the range are closed

Returns: Column of data type Date


pl.dateRangeAsSeries ​

Generate a date range as a Series.

fsharp
pl.dateRangeAsSeries : name: string -> start: DateOnly -> endRange: DateOnly -> interval: Dur -> closed: ClosedInterval -> Series

Parameters

NameTypeDescription
namestringName of the series.
startDateOnlyLower bound of the date range.
endRangeDateOnlyUpper bound of the date range.
intervalDurInterval of the range periods, “1w2d” # 1 week, 2 days.Default is 1 day.
closedClosedIntervalDefine 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

fsharp
pl.dateRanges : start: DateOnly -> endRange: DateOnly -> interval: Dur -> closed: ClosedInterval -> Expr

Parameters

NameTypeDescription
startDateOnlyLower bound of the date range.
endRangeDateOnlyUpper bound of the date range.
intervalDurInterval of the range periods, “1w2d” # 1 week, 2 days.Default is 1 day.
closedClosedIntervalDefine which sides of the range are closed

Returns: Column of data type Date


pl.dateRangesAsSeries ​

Generate a date range as a Series.

fsharp
pl.dateRangesAsSeries : name: string -> start: DateOnly -> endRange: DateOnly -> interval: Dur -> closed: ClosedInterval -> Series

Parameters

NameTypeDescription
namestringName of the series.
startDateOnlyLower bound of the date range.
endRangeDateOnlyUpper bound of the date range.
intervalDurInterval of the range periods, “1w2d” # 1 week, 2 days.Default is 1 day.
closedClosedIntervalDefine which sides of the range are closed

Returns: Column of data type Date


pl.datetime ​

Datetime data type.

fsharp
pl.datetime : unit: TimeUnit -> timeZone: string option -> DataType

Parameters

NameTypeDescription
unitTimeUnit-
timeZonestring option-

pl.datetimeRange ​

Generate a datetime range.

fsharp
pl.datetimeRange : start: DateTime -> endRange: DateTime -> interval: Dur -> closed: ClosedInterval -> unit: TimeUnit -> timeZone: string option -> Expr

Parameters

NameTypeDescription
startDateTimeLower bound of the datetime range.
endRangeDateTimeUpper bound of the datetime range.
intervalDurInterval of the range periods
closedClosedIntervalDefine which sides of the range are closed
unitTimeUnitTime unit of the resulting Datetime data type.
timeZonestring optionTime zone of the resulting Datetime data type.

pl.datetimeRangeAsSeries ​

Converts a datetime range expression to a Series with the specified name.

fsharp
pl.datetimeRangeAsSeries : name: string -> start: DateTime -> endRange: DateTime -> interval: Dur -> closed: ClosedInterval -> unit: TimeUnit -> timeZone: string option -> Series

Parameters

NameTypeDescription
namestringName of the resulting Series.
startDateTimeStart datetime of the range.
endRangeDateTimeEnd datetime of the range.
intervalDurInterval between datetime values.
closedClosedIntervalClosed window of the range.
unitTimeUnitTime unit of the resulting Datetime data type.
timeZonestring optionTime 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.

fsharp
pl.datetimeRanges : start: DateTime -> endRange: DateTime -> interval: Dur -> closed: ClosedInterval -> unit: TimeUnit -> timeZone: string option -> Expr

Parameters

NameTypeDescription
startDateTime-
endRangeDateTime-
intervalDur-
closedClosedInterval-
unitTimeUnit-
timeZonestring option-

pl.datetimeRangesAsSeries ​

Converts a datetime range expression to a Series with the specified name.

fsharp
pl.datetimeRangesAsSeries : name: string -> start: DateTime -> endRange: DateTime -> interval: Dur -> closed: ClosedInterval -> unit: TimeUnit -> timeZone: string option -> Series

Parameters

NameTypeDescription
namestring-
startDateTime-
endRangeDateTime-
intervalDur-
closedClosedInterval-
unitTimeUnit-
timeZonestring option-

pl.decimal ​

Decimal data type.

fsharp
pl.decimal : precision: int -> scale: int -> DataType

Parameters

NameTypeDescription
precisionint-
scaleint-

pl.duration ​

Duration (TimeSpan) data type.

fsharp
pl.duration : unit: TimeUnit -> DataType

Parameters

NameTypeDescription
unitTimeUnit-

pl.enumType ​

Create an Enum data type with the given categories.

fsharp
pl.enumType : categories: Categories -> DataType

Parameters

NameTypeDescription
categoriesCategoriesThe categories.

pl.escapeRegex ​

Escapes string regex meta characters.

fsharp
pl.escapeRegex : s: string -> string

Parameters

NameTypeDescription
sstringThe 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).

fsharp
pl.excludeCols : columns: seq<string> -> Expr

Parameters

NameTypeDescription
columnsseq<string>-

pl.excludeDataTypes ​

Represent all columns except for the given datatypes. Syntactic sugar for pl.all().Exclude(dtypes).

fsharp
pl.excludeDataTypes : dtypes: seq<DataType> -> Expr

Parameters

NameTypeDescription
dtypesseq<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.

fsharp
pl.explainAll : lazyFrames: seq<LazyFrame> -> string

Parameters

NameTypeDescription
lazyFramesseq<LazyFrame>A list of LazyFrames to collect.

Returns: Explained plan.


pl.extensionType ​

Create an Extension data type

fsharp
pl.extensionType : name: string -> inner: DataType -> metadata: string option -> DataType

Parameters

NameTypeDescription
namestringThe registered name of the extension type (e.g. "geoarrow.wkb")
innerDataTypeThe physical storage data type
metadatastring optionOptional metadata string

pl.field ​

Create a Struct Field with the given name and data type.

fsharp
pl.field : name: string -> dtype: DataType -> Field

Parameters

NameTypeDescription
namestringThe field name.
dtypeDataTypeThe data type.

pl.firstCol ​

Get the first column.

fsharp
pl.firstCol : unit -> Selector

pl.firstValue ​

Get the first value of the group/series.

fsharp
pl.firstValue : columns: seq<string> -> (unit -> Expr)

Parameters

NameTypeDescription
columnsseq<string>-

Returns: A new expression representing the first value.


pl.fold ​

Accumulate over multiple columns horizontally/row-wise.

fsharp
pl.fold : f: (Expr -> (Expr -> Expr)) -> acc: Expr -> exprs: seq<Expr> -> Expr

Parameters

NameTypeDescription
f(Expr -> (Expr -> Expr))-
accExpr-
exprsseq<Expr>-

pl.format ​

Format expressions as a string.

fsharp
pl.format : format: string -> exprs: seq<'a> -> Expr

Parameters

NameTypeDescription
formatstring-
exprsseq<'a>-

pl.fromEpoch ​

Parses an integer column (seconds, milliseconds, etc.) into a Datetime or Date expression.

fsharp
pl.fromEpoch : column: Expr -> timeUnit: EpochTimeUnit -> Expr

Parameters

NameTypeDescription
columnExpr-
timeUnitEpochTimeUnit-

pl.ifElse ​

Create an if-else expression.

fsharp
pl.ifElse : predicate: Expr -> ifTrue: Expr -> ifFalse: Expr -> Expr

Parameters

NameTypeDescription
predicateExpr-
ifTrueExpr-
ifFalseExpr-

pl.implode ​

Aggregate all column values into a list. This function is syntactic sugar for pl.col(name).Implode().

fsharp
pl.implode : column: string -> Expr

Parameters

NameTypeDescription
columnstringColumn name

pl.intRange ​

Generate a range of integers as an Expression.

fsharp
pl.intRange : start: int64 -> endRange: int64 -> step: int64 -> Expr

Parameters

NameTypeDescription
startint64Start of the range (inclusive).
endRangeint64End of the range (exclusive).
stepint64Step size of the range.

Returns: A Literal Expression containing the integer series.


pl.intRangeAsSeries ​

Generate a range of integers as a Series.

fsharp
pl.intRangeAsSeries : name: string -> start: int64 -> endRange: int64 -> step: int64 -> Series

Parameters

NameTypeDescription
namestringName of the series.
startint64Start of the range (inclusive).
endRangeint64End of the range (exclusive).
stepint64Step 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).

fsharp
pl.intRanges : start: int64 -> endRange: int64 -> step: int64 -> Expr

Parameters

NameTypeDescription
startint64-
endRangeint64-
stepint64-

pl.intRangesAsSeries ​

fsharp
pl.intRangesAsSeries : name: string -> start: int64 -> endRange: int64 -> step: int64 -> Series

Parameters

NameTypeDescription
namestring-
startint64-
endRangeint64-
stepint64-

pl.lastCol ​

Get the last column.

fsharp
pl.lastCol : unit -> Selector

pl.lastValue ​

Get the last value of the group/series.

fsharp
pl.lastValue : columns: seq<string> -> (unit -> Expr)

Parameters

NameTypeDescription
columnsseq<string>-

Returns: A new expression representing the first value.


pl.len ​

Return the lines count of current context.

fsharp
pl.len : unit -> Expr

pl.linearSpace ​

Generate a series of equally-spaced points.

fsharp
pl.linearSpace : start: Expr -> endRange: Expr -> numSamples: int -> closed: ClosedInterval -> Expr

Parameters

NameTypeDescription
startExprLower bound of the linear space.
endRangeExprUpper bound of the linear space.
numSamplesintNumber of samples to generate.
closedClosedIntervalWhether the intervals are closed or open.

pl.linearSpaceAsSeries ​

Converts a linear space expression to a Series with the specified name.

fsharp
pl.linearSpaceAsSeries : name: string -> start: Expr -> endRange: Expr -> numSamples: int -> closed: ClosedInterval -> Series

Parameters

NameTypeDescription
namestringName of the resulting Series.
startExprLower bound of the linear space.
endRangeExprUpper bound of the linear space.
numSamplesintNumber of samples to generate.
closedClosedIntervalWhether the intervals are closed or open.

pl.linearSpaces ​

Create a column of linearly-spaced sequences for each row.

fsharp
pl.linearSpaces : start: Expr -> endRange: Expr -> numSamples: int -> closed: ClosedInterval -> asArray: bool -> Expr

Parameters

NameTypeDescription
startExprLower bound.
endRangeExprUpper bound.
numSamplesintNumber of samples.
closedClosedIntervalWhether the intervals are closed or open.
asArrayboolIf 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.

fsharp
pl.linearSpacesAsSeries : name: string -> start: Expr -> endRange: Expr -> numSamples: int -> closed: ClosedInterval -> asArray: bool -> Series

Parameters

NameTypeDescription
namestringName of the resulting Series.
startExprLower bound.
endRangeExprUpper bound.
numSamplesintNumber of samples.
closedClosedIntervalWhether the intervals are closed or open.
asArrayboolIf true, returns an Array dtype instead of List. Requires numSamples to be a constant.

pl.list ​

List data type.

fsharp
pl.list : inner: DataType -> DataType

Parameters

NameTypeDescription
innerDataType-

pl.lit ​

Create a literal expression from a value.

fsharp
pl.lit : value: 'T -> Expr

Parameters

NameTypeDescription
value'T-

Example

fsharp
df.Filter(pl.col("Age") .> pl.lit(18))

pl.lit$W ​

fsharp
pl.lit$W : op_Dollar: (LitMechanism -> ('T -> Expr)) -> value: 'T -> Expr

Parameters

NameTypeDescription
op_Dollar(LitMechanism -> ('T -> Expr))-
value'T-

pl.litBinary ​

Creates a scalar Binary Literal Expression from a byte array.

fsharp
pl.litBinary : value: byte[] -> Expr

Parameters

NameTypeDescription
valuebyte[]-

pl.litNull ​

Create a literal expression for null value.

fsharp
pl.litNull : unit -> Expr

pl.litSeries ​

Create a literal expression from a Series.

fsharp
pl.litSeries : series: Series -> Expr

Parameters

NameTypeDescription
seriesSeries-

pl.litStruct ​

Create a Struct Expression from a single anonymous record or class instance.

Example: pl.litStruct {| A = 1; B = "hi" |}

fsharp
pl.litStruct : value: 'T -> Expr

Parameters

NameTypeDescription
value'TThe 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.

fsharp
pl.litStructs : values: seq<'T> -> Expr

Parameters

NameTypeDescription
valuesseq<'T>The sequence of objects to pack.

pl.max ​

Get the maximum value. Syntactic sugar for Col(names).Max().

fsharp
pl.max : names: seq<string> -> Expr

Parameters

NameTypeDescription
namesseq<string>Name(s) of the columns to use in the aggregation.

pl.maxHorizontal ​

Get the maximum value horizontally across columns.

fsharp
pl.maxHorizontal : exprs: seq<Expr> -> Expr

Parameters

NameTypeDescription
exprsseq<Expr>Column(s) to use in the aggregation.

pl.mean ​

Get the Mean value. Syntactic sugar for Col(names).Mean().

fsharp
pl.mean : names: seq<string> -> Expr

Parameters

NameTypeDescription
namesseq<string>Name(s) of the columns to use in the aggregation.

pl.meanHorizontal ​

Compute the mean of all values horizontally across columns.

fsharp
pl.meanHorizontal : exprs: seq<Expr> -> ignoreNulls: bool -> Expr

Parameters

NameTypeDescription
exprsseq<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.
ignoreNullsboolIgnore 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().

fsharp
pl.median : names: seq<string> -> Expr

Parameters

NameTypeDescription
namesseq<string>One or more column names.

pl.nUnique ​

Count unique values.This function is syntactic sugar for pl.col(columns).NUnique().

fsharp
pl.nUnique : names: seq<string> -> Expr

Parameters

NameTypeDescription
namesseq<string>-

pl.nth ​

Get the nth column(s) of the context.

fsharp
pl.nth : indices: seq<int64> -> Selector

Parameters

NameTypeDescription
indicesseq<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.

fsharp
pl.ones : n: int -> Expr

Parameters

NameTypeDescription
nintLength of the resulting column.

pl.onesAsSeries ​

fsharp
pl.onesAsSeries : n: int -> Series

Parameters

NameTypeDescription
nint-

pl.otherwise ​

Terminal operator that provides the default fallback expression for a when-then-otherwise chain.

fsharp
pl.otherwise : fallback: Expr -> thenBlock: ThenBranch -> Expr

Parameters

NameTypeDescription
fallbackExprThe fallback expression.
thenBlockThenBranchThe ThenBranch collector block.

Returns: The compiled ternary expression tree.


pl.quantile ​

Syntactic sugar for pl.Col("foo").Quantile(..).

fsharp
pl.quantile : column: string -> quantile: float -> interpolation: QuantileMethod -> Expr

Parameters

NameTypeDescription
columnstringColumn name.
quantilefloatQuantile between 0.0 and 1.0.
interpolationQuantileMethodInterpolation method.

pl.reduce ​

Reduce multiple columns horizontally/row-wise.

fsharp
pl.reduce : f: (Expr -> (Expr -> Expr)) -> exprs: seq<Expr> -> Expr

Parameters

NameTypeDescription
f(Expr -> (Expr -> Expr))-
exprsseq<Expr>-

pl.registerExtensionAsStorage ​

Register the extension type to be passed through purely as physical storage.

fsharp
pl.registerExtensionAsStorage : extName: string -> unit

Parameters

NameTypeDescription
extNamestringThe registered name.

pl.registerExtensionType ​

Register the extension type for the given extension name.

fsharp
pl.registerExtensionType : extName: string -> factory: ((DataType * string option) -> DataType) -> unit

Parameters

NameTypeDescription
extNamestringThe 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.

fsharp
pl.repeat : value: Expr -> n: int -> dtype: DataType option -> Expr

Parameters

NameTypeDescription
valueExprValue to repeat.
nintLength of the resulting column.
dtypeDataType optionData 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 ​

fsharp
pl.repeatAsSeries : value: Expr -> n: int -> dtype: DataType option -> Series

Parameters

NameTypeDescription
valueExpr-
nint-
dtypeDataType 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.

fsharp
pl.rollingCorr : a: Expr -> b: Expr -> windowSize: uint32 -> minSamples: uint32 option -> Expr

Parameters

NameTypeDescription
aExprColumn name or Expression.
bExprColumn name or Expression.
windowSizeuint32The length of the window.
minSamplesuint32 optionThe 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.

fsharp
pl.rollingCov : a: Expr -> b: Expr -> windowSize: uint32 -> minSamples: uint32 option -> ddof: byte -> Expr

Parameters

NameTypeDescription
aExprColumn name or Expression.
bExprColumn name or Expression.
windowSizeuint32The length of the window.
minSamplesuint32 optionThe 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.
ddofbyteDelta 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.

fsharp
pl.schema : fields: seq<Field> -> PolarsSchema

Parameters

NameTypeDescription
fieldsseq<Field>-

pl.selectExprsEager ​

Run polars expressions without a context. This is syntactic sugar for running df.select on an empty DataFrame.

fsharp
pl.selectExprsEager : exprs: seq<Expr> -> DataFrame

Parameters

NameTypeDescription
exprsseq<Expr>-

pl.selectExprsLazy ​

Run polars expressions without a context. This is syntactic sugar for running lf.select on an empty LazyFrame.

fsharp
pl.selectExprsLazy : exprs: seq<Expr> -> LazyFrame

Parameters

NameTypeDescription
exprsseq<Expr>-

pl.selfDataType ​

Represents the intrinsic data type of the current element. Equivalent to Python's polars.self_dtype()

fsharp
pl.selfDataType : unit -> DataTypeExpr

pl.series ​

Create a Series from a sequence of values.

fsharp
pl.series : name: string -> data: seq<'T> -> Series

Parameters

NameTypeDescription
namestring-
dataseq<'T>-

pl.setEnvVar ​

Set environment variable.

fsharp
pl.setEnvVar : key: string -> value: string -> unit

Parameters

NameTypeDescription
keystring-
valuestring-

pl.sqlContext ​

Create a SQL context for executing SQL queries on LazyFrames.

fsharp
pl.sqlContext : unit -> SqlContext

pl.sqlExpr ​

Create a Polars Expr from a SQL string.

fsharp
pl.sqlExpr : sql: string -> Expr

Parameters

NameTypeDescription
sqlstringThe 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.

fsharp
pl.sqlExprs : sqls: seq<string> -> Expr[]

Parameters

NameTypeDescription
sqlsseq<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).

fsharp
pl.std : column: string -> ddof: byte -> Expr

Parameters

NameTypeDescription
columnstringColumn name.
ddofbyte“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

fsharp
pl.structSeries : exprs: seq<Expr> -> Series

Parameters

NameTypeDescription
exprsseq<Expr>-

pl.structType ​

Struct data type.

fsharp
pl.structType : fields: seq<Field> -> DataType

Parameters

NameTypeDescription
fieldsseq<Field>-

pl.sum ​

Get the Sum value. Syntactic sugar for Col(names).Sum().

fsharp
pl.sum : names: seq<string> -> Expr

Parameters

NameTypeDescription
namesseq<string>Name(s) of the columns to use in the aggregation.

pl.sumHorizontal ​

Sum all values horizontally across columns.

fsharp
pl.sumHorizontal : exprs: seq<Expr> -> ignoreNulls: bool -> Expr

Parameters

NameTypeDescription
exprsseq<Expr>An iterable of expressions
ignoreNullsboolWhether to ignore null values

pl.then' ​

Connects a statement expression to the preceding when' condition.

fsharp
pl.then' : statement: Expr -> whenBlock: WhenCondition -> ThenBranch

Parameters

NameTypeDescription
statementExprThe expression to evaluate if the condition is true.
whenBlockWhenConditionThe WhenCondition block built by pl.when'.

Returns: A new ThenBranch collector block.


pl.threadPoolSize ​

Get thread pool size.

fsharp
pl.threadPoolSize : unit -> int

pl.timeRange ​

Generate a time range.

fsharp
pl.timeRange : start: TimeOnly -> endRange: TimeOnly -> interval: Dur -> closed: ClosedInterval -> Expr

Parameters

NameTypeDescription
startTimeOnlyLower bound of the time range. If omitted, defaults to TimeOnly.MinValue
endRangeTimeOnly-
intervalDurInterval of the range periods
closedClosedIntervalDefine which sides of the range are closed.

pl.timeRangeAsSeries ​

Converts a time range expression to a Series with the specified name.

fsharp
pl.timeRangeAsSeries : name: string -> start: TimeOnly -> endRange: TimeOnly -> interval: Dur -> closed: ClosedInterval -> Series

Parameters

NameTypeDescription
namestringName of the resulting Series.
startTimeOnlyStart time of the range.
endRangeTimeOnlyEnd time of the range.
intervalDurInterval between time values.
closedClosedIntervalClosed window of the range.

pl.timeRanges ​

Creates a time range expression from the specified start, end, interval, and closed window.

fsharp
pl.timeRanges : start: TimeOnly -> endRange: TimeOnly -> interval: Dur -> closed: ClosedInterval -> Expr

Parameters

NameTypeDescription
startTimeOnlyStart time of the range.
endRangeTimeOnlyEnd time of the range.
intervalDurInterval between time values.
closedClosedIntervalClosed window of the range.

pl.timeRangesAsSeries ​

Converts a time range expression to a Series with the specified name.

fsharp
pl.timeRangesAsSeries : name: string -> start: TimeOnly -> endRange: TimeOnly -> interval: Dur -> closed: ClosedInterval -> Series

Parameters

NameTypeDescription
namestringName of the resulting Series.
startTimeOnlyStart time of the range.
endRangeTimeOnlyEnd time of the range.
intervalDurInterval between time values.
closedClosedIntervalClosed window of the range.

pl.tryGetExtensionType ​

Get the extension type registration info for the given extension name.

fsharp
pl.tryGetExtensionType : extName: string -> ExtensionRegistration option

Parameters

NameTypeDescription
extNamestringThe registered name.

pl.unregisterExtensionType ​

Unregister the extension type for the given extension name.

fsharp
pl.unregisterExtensionType : extName: string -> unit

Parameters

NameTypeDescription
extNamestringThe registered name.

pl.var ​

Get the variance. This function is syntactic sugar for Pl.Col(column).Var(ddof).

fsharp
pl.var : column: string -> ddof: byte -> Expr

Parameters

NameTypeDescription
columnstringColumn name.
ddofbyte“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#.

fsharp
pl.when' : condition: Expr -> WhenCondition

Parameters

NameTypeDescription
conditionExprThe 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.

fsharp
pl.zeros : n: int -> Expr

Parameters

NameTypeDescription
nintLength of the resulting column.

pl.zerosAsSeries ​

fsharp
pl.zerosAsSeries : n: int -> Series

Parameters

NameTypeDescription
nint-

Released under the MIT License. Powered by the Polars Rust core & Apache Arrow.