DataType
Namespace: Polars.FSharp
Polars data types for casting and schema definitions.
Properties & Indexers
| Property | Type | Description |
|---|---|---|
ArrayShape | uint32[] | Gets the dimensional shape of the Array. |
ArrayWidth | uint32 | Gets the first-dimension fixed width (number of elements in the leading dimension) of the Array. |
Binary | DataType | - |
Boolean | DataType | - |
Categories | Categories | The categories of this DataType, if it is a Categorical type. |
Code | int | - |
Date | DataType | - |
EnumCategories | FrozenCategories | The frozen categories of this DataType, if it is an Enum type. |
Float16 | DataType | - |
Float32 | DataType | - |
Float64 | DataType | - |
InnerType | DataType | Gets the immediate inner element DataType of an Array or a List. |
Int128 | DataType | - |
Int16 | DataType | - |
Int32 | DataType | - |
Int64 | DataType | - |
Int8 | DataType | - |
IsCategorical | bool | - |
IsDecimal | bool | - |
IsEnum | bool | - |
IsExtension | bool | - |
IsFloat | bool | - |
IsInteger | bool | - |
IsNested | bool | - |
IsNumeric | bool | - |
IsSignedInteger | bool | - |
IsTemporal | bool | - |
IsUnsignedInteger | bool | - |
Kind | DataTypeKind | - |
LeafType | DataType | Recursively unwraps all outer Array and List layers to retrieve the leaf (primitive/base) DataType. Returns itself if this DataType is not nested. |
Null | DataType | - |
Precision | int | Gets the decimal precision. Throws InvalidOperationException if the data type is not Decimal. |
SameAsInput | DataType | - |
Scale | int | Gets the decimal scale. Throws InvalidOperationException if the data type is not Decimal. |
String | DataType | - |
Time | DataType | - |
TimeUnit | TimeUnit | - |
TimeZone | string option | - |
TimeZoneInfo | TimeZoneInfo option | - |
UInt128 | DataType | - |
UInt16 | DataType | - |
UInt32 | DataType | - |
UInt64 | DataType | - |
UInt8 | DataType | - |
Unknown | DataType | - |
Constructors & Static Methods
new
fsharp
new(handle: DataTypeHandle, kind: DataTypeKind) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
handle | DataTypeHandle | - |
kind | DataTypeKind | - |
Array
fsharp
static member Array(inner: DataType, shape: uint32[]) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
inner | DataType | - |
shape | uint32[] | - |
Categorical
fsharp
static member Categorical(?categories: Categories) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
categories | Categories (optional) | - |
Datetime
fsharp
static member Datetime(unit: TimeUnit, ?tz: string) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
unit | TimeUnit | - |
tz | string (optional) | - |
Decimal
fsharp
static member Decimal(?precision: int, ?scale: int) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
precision | int (optional) | - |
scale | int (optional) | - |
Duration
fsharp
static member Duration(unit: TimeUnit) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
unit | TimeUnit | - |
Enum
fsharp
static member Enum(frozen: FrozenCategories) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
frozen | FrozenCategories | - |
Extension
fsharp
static member Extension(name: string, storage: DataType, ?metadata: string) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
name | string | - |
storage | DataType | - |
metadata | string (optional) | - |
FromArrowType
fsharp
static member FromArrowType(arrowType: IArrowType) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
arrowType | IArrowType | - |
FromHandle
fsharp
static member FromHandle(handle: DataTypeHandle) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
handle | DataTypeHandle | - |
FromNetType
fsharp
static member FromNetType : unit -> DataType
static member FromNetType(t: Type) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
t | Type | - |
List
fsharp
static member List(inner: DataType) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
inner | DataType | - |
Struct
fsharp
static member Struct(fields: seq<Field>) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
fields | seq<Field> | - |
Operators
op_Equality
fsharp
static member op_Equality(left: DataType, right: DataType) : boolParameters
| Name | Type | Description |
|---|---|---|
left | DataType | - |
right | DataType | - |
op_Implicit
fsharp
static member op_Implicit(t: Type) : DataTypeParameters
| Name | Type | Description |
|---|---|---|
t | Type | - |
op_Inequality
fsharp
static member op_Inequality(left: DataType, right: DataType) : boolParameters
| Name | Type | Description |
|---|---|---|
left | DataType | - |
right | DataType | - |
Instance Methods
GetArrowType
fsharp
member GetArrowType : unit -> IArrowTypeGetNetType
fsharp
member GetNetType : unit -> TypeToDataTypeExpr
Convert this DataType to a DataTypeExpr literal. Equivalent to Python's polars.DataType.to_dtype_expr()
fsharp
member ToDataTypeExpr : unit -> DataTypeExprToPlDataType
Get the corresponding PlDataType enum value.
fsharp
member ToPlDataType : unit -> PlDataTypeTryGetArrayInfo
Safely attempts to extract Array metadata without throwing exceptions.
fsharp
member TryGetArrayInfo : unit -> (DataType * uint32[]) optionReturns: Some(inner, shape) if this is an Array; otherwise None.
TryGetCategories
fsharp
member TryGetCategories : unit -> Categories optionTryGetDecimalInfo
Attempts to extract Decimal metadata safely.
fsharp
member TryGetDecimalInfo : unit -> (int * int) optionTryGetEnumCategories
fsharp
member TryGetEnumCategories : unit -> FrozenCategories optionTryGetInnerType
Safely attempts to extract the inner element DataType without throwing an exception.
fsharp
member TryGetInnerType : unit -> DataType optionReturns: Some(inner) if the type is an Array or List; otherwise None.