Skip to content

Series.Struct (SeriesStructOps) ​

Namespace: Polars.CSharp

Series Struct Ops Namespace

Properties & Indexers ​

PropertyTypeDescription
Fieldsstring[]Get the names of the fields.
SchemaIReadOnlyDictionary<string, DataType>Get the struct definition as a name/dtype schema.
this[long index]SeriesRetrieve a field from the struct by index.
this[string name]SeriesRetrieve one of the fields of this Struct as a new Series.
this[string[] names]SeriesRetrieve a field from the struct by name. Returns a new Series of that field's type.

Instance Methods ​

Drop ​

Drop one or more fields from the struct.

csharp
public Series Drop(IEnumerable<string> names, bool strict = true)

Parameters

NameTypeDescription
namesIEnumerable<string>Names of the fields to drop.
strictboolIf True, raise an error if any of the specified fields do not exist in the struct.

Field ​

Retrieve a field from the struct by name. Returns a new Series of that field's type.

Retrieve a field from the struct by index.

csharp
public Series Field(params string[] name)
public Series Field(long index)

Parameters

NameTypeDescription
namestring[]-
indexlong-

JsonEncode ​

Convert struct to JSON string.

csharp
public Series JsonEncode()

RenameFields ​

Rename the fields of the struct.

csharp
public Series RenameFields(params string[] names)

Parameters

NameTypeDescription
namesstring[]-

Unnest ​

Unnest the struct column into a DataFrame. Each field of the struct becomes a separate column.

csharp
public DataFrame Unnest()

WithFields ​

Add or overwrite fields of this struct.This is similar to with_columns on DataFrame.

csharp
public Series WithFields(params IntoExprColumn[] expr)

Parameters

NameTypeDescription
exprIntoExprColumn[]Field(s) to add, specified as positional arguments. Accepts expression input. Strings are parsed as column names, other non-expression inputs are parsed as literals.

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