pub enum DataType {
Show 27 variants
Boolean,
UInt8,
UInt16,
UInt32,
UInt64,
Int8,
Int16,
Int32,
Int64,
Float32,
Float64,
Decimal(Option<usize>, Option<usize>),
String,
Binary,
BinaryOffset,
Date,
Datetime(TimeUnit, Option<PlSmallStr>),
Duration(TimeUnit),
Time,
Array(Box<DataType>, usize),
List(Box<DataType>),
Object(&'static str, Option<Arc<ObjectRegistry>>),
Null,
Categorical(Option<Arc<RevMapping>>, CategoricalOrdering),
Enum(Option<Arc<RevMapping>>, CategoricalOrdering),
Struct(Vec<Field>),
Unknown(UnknownKind),
}
Variants§
Boolean
UInt8
UInt16
UInt32
UInt64
Int8
Int16
Int32
Int64
Float32
Float64
Decimal(Option<usize>, Option<usize>)
dtype-decimal
only.Fixed point decimal type optional precision and non-negative scale. This is backed by a signed 128-bit integer which allows for up to 38 significant digits. Meaning max precision is 38.
String
String data
Binary
BinaryOffset
Date
A 32-bit date representing the elapsed time since UNIX epoch (1970-01-01) in days (32 bits).
Datetime(TimeUnit, Option<PlSmallStr>)
A 64-bit date representing the elapsed time since UNIX epoch (1970-01-01) in the given timeunit (64 bits).
Duration(TimeUnit)
Time
A 64-bit time representing the elapsed time since midnight in nanoseconds
Array(Box<DataType>, usize)
dtype-array
only.A nested list with a fixed size in each row
List(Box<DataType>)
A nested list with a variable size in each row
Object(&'static str, Option<Arc<ObjectRegistry>>)
object
only.A generic type that can be used in a Series
&’static str can be used to determine/set inner type
Null
Categorical(Option<Arc<RevMapping>>, CategoricalOrdering)
dtype-categorical
only.Enum(Option<Arc<RevMapping>>, CategoricalOrdering)
dtype-categorical
only.Struct(Vec<Field>)
dtype-struct
only.Unknown(UnknownKind)
Implementations§
source§impl DataType
impl DataType
pub fn value_within_range(&self, other: AnyValue<'_>) -> bool
sourcepub fn get_shape(&self) -> Option<Vec<usize>>
Available on crate feature dtype-array
only.
pub fn get_shape(&self) -> Option<Vec<usize>>
dtype-array
only.Get the full shape of a multidimensional array.
sourcepub fn inner_dtype(&self) -> Option<&DataType>
pub fn inner_dtype(&self) -> Option<&DataType>
Get the inner data type of a nested type.
sourcepub fn leaf_dtype(&self) -> &DataType
pub fn leaf_dtype(&self) -> &DataType
Get the absolute inner data type of a nested type.
sourcepub fn cast_leaf(&self, to: DataType) -> DataType
pub fn cast_leaf(&self, to: DataType) -> DataType
Cast the leaf types of Lists/Arrays and keep the nesting.
pub fn implode(self) -> DataType
sourcepub fn to_physical(&self) -> DataType
pub fn to_physical(&self) -> DataType
Convert to the physical data type
sourcepub fn is_logical(&self) -> bool
pub fn is_logical(&self) -> bool
Check if this DataType
is a logical type
sourcepub fn is_temporal(&self) -> bool
pub fn is_temporal(&self) -> bool
Check if this DataType
is a temporal type
sourcepub fn is_primitive(&self) -> bool
pub fn is_primitive(&self) -> bool
Check if datatype is a primitive type. By that we mean that it is not a container type.
sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Check if this DataType
is a basic numeric type (excludes Decimal).
pub fn is_nested(&self) -> bool
pub fn is_binary(&self) -> bool
pub fn is_date(&self) -> bool
pub fn is_object(&self) -> bool
pub fn is_null(&self) -> bool
pub fn contains_views(&self) -> bool
pub fn contains_categoricals(&self) -> bool
pub fn contains_objects(&self) -> bool
sourcepub fn is_decimal(&self) -> bool
pub fn is_decimal(&self) -> bool
Check if this DataType
is a Decimal type (of any scale/precision).
sourcepub fn is_float(&self) -> bool
pub fn is_float(&self) -> bool
Check if this DataType
is a basic floating point type (excludes Decimal).
sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Check if this DataType
is an integer.
pub fn is_signed_integer(&self) -> bool
pub fn is_unsigned_integer(&self) -> bool
pub fn is_string(&self) -> bool
pub fn is_categorical(&self) -> bool
pub fn is_enum(&self) -> bool
sourcepub fn to_arrow_field(
&self,
name: PlSmallStr,
compat_level: CompatLevel,
) -> Field
pub fn to_arrow_field( &self, name: PlSmallStr, compat_level: CompatLevel, ) -> Field
Convert to an Arrow Field
sourcepub fn to_arrow(&self, compat_level: CompatLevel) -> ArrowDataType
pub fn to_arrow(&self, compat_level: CompatLevel) -> ArrowDataType
Convert to an Arrow data type.
pub fn try_to_arrow( &self, compat_level: CompatLevel, ) -> Result<ArrowDataType, PolarsError>
pub fn is_nested_null(&self) -> bool
pub fn matches_schema_type( &self, schema_type: &DataType, ) -> Result<bool, PolarsError>
Trait Implementations§
source§impl From<&ArrowDataType> for DataType
impl From<&ArrowDataType> for DataType
source§fn from(dt: &ArrowDataType) -> DataType
fn from(dt: &ArrowDataType) -> DataType
source§impl PartialEq<ArrowDataType> for DataType
impl PartialEq<ArrowDataType> for DataType
impl Eq for DataType
Auto Trait Implementations§
impl Freeze for DataType
impl !RefUnwindSafe for DataType
impl Send for DataType
impl Sync for DataType
impl Unpin for DataType
impl !UnwindSafe for DataType
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()
] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
]. Read more