Skip to content

Series.Array (SeriesArrayOps) ​

Namespace: Polars.CSharp

Wrapper for Array (Fixed-Size List) operations on a Series.

Instance Methods ​

Agg ​

Run any polars aggregation expression against the arrays’ elements.

csharp
public Series Agg(Expr expr)

Parameters

NameTypeDescription
exprExpr-

All ​

Check if all elements in the sub-array are true.

csharp
public Series All(bool ignoreNulls = true)

Parameters

NameTypeDescription
ignoreNullsbool-

Any ​

Check if any element in the sub-array is true.

csharp
public Series Any(bool ignoreNulls = true)

Parameters

NameTypeDescription
ignoreNullsbool-

ArgMax ​

Get the index of the maximum value in every sub-array.

csharp
public Series ArgMax()

ArgMin ​

Get the index of the minimum value in every sub-array.

csharp
public Series ArgMin()

Contains ​

Check if sub-array contains a specific item.

csharp
public Series Contains(Expr item, bool nullsEqual = false)

Parameters

NameTypeDescription
itemExpr-
nullsEqualbool-

CountMatches ​

Count how often the value produced by element occurs.

csharp
public Series CountMatches(Expr element)

Parameters

NameTypeDescription
elementExprAn expression that produces a single value

Eval ​

Run any polars expression against the arrays’ elements.

csharp
public Series Eval(Expr expr, bool asList = false)

Parameters

NameTypeDescription
exprExprExpression to run. Note that you can select an element with pl.element()
asListboolCollect the resulting data as a list. This allows for expressions which output a variable amount of data.

Explode ​

Explode the array column into multiple rows. The resulting Series will be longer than the original.

csharp
public Series Explode(bool emptyAsNull = true, bool keepNulls = true)

Parameters

NameTypeDescription
emptyAsNullbool-
keepNullsbool-

First ​

Get the first value of the sub-arrays.

csharp
public Series First()

Get ​

Get element at index from every sub-array.

csharp
public Series Get(long index, bool nullOnOob = true)

Parameters

NameTypeDescription
indexlong-
nullOnOobbool-

Join ​

Join elements with a separator.

csharp
public Series Join(string separator, bool ignoreNulls = true)

Parameters

NameTypeDescription
separatorstring-
ignoreNullsbool-

Last ​

Get the last value of the sub-arrays.

csharp
public Series Last()

Len ​

Return the number of elements in each array.

csharp
public Series Len()

Max ​

Compute the max value of every sub-array.

csharp
public Series Max()

Mean ​

Compute the mean of every sub-array.

csharp
public Series Mean()

Median ​

Compute the median of every sub-array.

csharp
public Series Median()

Min ​

Compute the min value of every sub-array.

csharp
public Series Min()

NUnique ​

Count the number of unique values in every sub-arrays.

csharp
public Series NUnique()

Reverse ​

Reverse elements in every sub-array.

csharp
public Series Reverse()

Sort ​

Sort elements in every sub-array.

csharp
public Series Sort(bool descending = false, bool nullsLast = false, bool maintainOrder = false)

Parameters

NameTypeDescription
descendingbool-
nullsLastbool-
maintainOrderbool-

Std ​

Compute the standard deviation of every sub-array.

csharp
public Series Std(byte ddof = 1)

Parameters

NameTypeDescription
ddofbyte-

Sum ​

Compute the sum of every sub-array.

csharp
public Series Sum()

ToList ​

Cast to variable-size List.

csharp
public Series ToList()

ToStruct ​

Convert array to struct. Useful for splitting embeddings into feature columns.

Convert array to a struct using a function to generate field names dynamically.

csharp
public Series ToStruct(params string[] fields)
public Series ToStruct(Func<int, string> nameGenerator, int fieldCount)

Parameters

NameTypeDescription
fieldsstring[]-
nameGeneratorFunc<int, string>A function that takes an index and returns a string.
fieldCountintThe expected number of fields to generate.

Unique ​

Get unique elements in every sub-array.

csharp
public Series Unique(bool maintainOrder = false)

Parameters

NameTypeDescription
maintainOrderbool-

Var ​

Compute the variance of every sub-array.

csharp
public Series Var(byte ddof = 1)

Parameters

NameTypeDescription
ddofbyte-

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