Polars DataType class (polars_dtype
)
Description
Polars supports a variety of data types that fall broadly under the following categories:
- Numeric data types: signed integers, unsigned integers, floating point numbers, and decimals.
- Nested data types: lists, structs, and arrays.
- Temporal: dates, datetimes, times, and time deltas.
- Miscellaneous: strings, binary data, Booleans, categoricals, and enums.
All types support missing values represented by the special value
null
. This is not to be conflated with the special value
NaN
in floating number data types; see the section about
floating point numbers for more information.
Usage
pl__Decimal(precision = NULL, scale = 0L)
pl__Datetime(time_unit = c("us", "ns", "ms"), time_zone = NULL)
pl__Duration(time_unit = c("us", "ns", "ms"))
pl__Categorical(ordering = c("physical", "lexical"))
pl__Enum(categories)
pl__Array(inner, shape)
pl__List(inner)
pl__Struct(...)
Arguments
precision
|
Single integer or NULL (default), maximum number of digits
in each number. If NULL , the precision is inferred.
|
scale
|
Single integer or NULL . Number of digits to the right of
the decimal point in each number. The default is 0 .
|
time_unit
|
One of “us” (default, microseconds), “ns”
(nanoseconds) or “ms” (milliseconds). Representing the unit
of time.
|
time_zone
|
A string or NULL (default). Representing the timezone.
|
ordering
|
One of “physical” (default) or “lexical” .
Ordering by order of appearance (“physical” ) or string
value (“lexical” ).
|
categories
|
A character vector. Should not contain NA values and all
values should be unique.
|
inner
|
A polars data type object. |
shape
|
A integer-ish vector, representing the shape of the Array. |
…
|
\<dynamic-dots \> Name-value pairs of polars data type. Each
pair represents a field of the Struct.
|
Details
Full data types table
Examples
#> Int8
#> Int16
#> Int32
#> Int64
#> UInt8
#> UInt16
#> UInt32
#> UInt64
#> Float32
#> Float64
#> Decimal(precision=NULL, scale=2)
#> String
#> Binary
#> Date
#> Time
#> Datetime(time_unit='us', time_zone=NULL)
#> Duration(time_unit='us')
#> Array(Int32, shape=c(2, 3))
#> List(Int32)
#> Categorical(ordering='physical')
#> Enum(categories=c('a', 'b', 'c'))
#> Struct(`a`=Int32, `b`=String)
#> Null