pub enum DType {
Show 13 variants
Null,
Bool,
BoolNullable,
Int64,
Int64Nullable,
Float64,
Utf8,
Categorical,
Timedelta64,
Datetime64,
Period,
Interval,
Sparse,
}Variants§
Null
Bool
BoolNullable
Nullable boolean extension dtype. Matches pandas BooleanDtype().
Int64
Int64Nullable
Nullable Int64 extension dtype. Matches pandas Int64Dtype() / pd.NA.
Float64
Utf8
Categorical
Timedelta64
Datetime64
Nanosecond-precision datetime since Unix epoch. Matches pandas datetime64[ns].
Period
Period ordinal. Matches pandas period[freq]. Stores ordinal + frequency code.
Interval
Numeric interval value. Matches pandas interval[float64].
Sparse
Implementations§
Source§impl DType
impl DType
Sourcepub const fn is_numeric(&self) -> bool
pub const fn is_numeric(&self) -> bool
Returns true if the dtype is numeric (integer or floating point).
Sourcepub const fn is_integer(&self) -> bool
pub const fn is_integer(&self) -> bool
Returns true if the dtype is an integer type.
Sourcepub const fn is_floating(&self) -> bool
pub const fn is_floating(&self) -> bool
Returns true if the dtype is a floating point type.
Sourcepub const fn is_datetime(&self) -> bool
pub const fn is_datetime(&self) -> bool
Returns true if the dtype is datetime.
Sourcepub const fn is_timedelta(&self) -> bool
pub const fn is_timedelta(&self) -> bool
Returns true if the dtype is timedelta.
Sourcepub const fn is_categorical(&self) -> bool
pub const fn is_categorical(&self) -> bool
Returns true if the dtype is categorical.
Sourcepub const fn is_interval(&self) -> bool
pub const fn is_interval(&self) -> bool
Returns true if the dtype is interval.
Sourcepub const fn name(&self) -> &'static str
pub const fn name(&self) -> &'static str
Return the dtype name as a string.
Matches numpy dtype.name property.
Sourcepub const fn kind(&self) -> char
pub const fn kind(&self) -> char
Return the dtype kind character.
Matches numpy dtype.kind property.
Sourcepub const fn itemsize(&self) -> usize
pub const fn itemsize(&self) -> usize
Return the dtype itemsize in bytes.
Matches numpy dtype.itemsize property.
Sourcepub const fn is_extension(&self) -> bool
pub const fn is_extension(&self) -> bool
Returns true if this is an extension dtype (categorical, sparse, period, interval, nullable).
Matches pd.api.types.is_extension_array_dtype().
Sourcepub const fn is_nullable(&self) -> bool
pub const fn is_nullable(&self) -> bool
Returns true if this is a nullable extension dtype (Int64, boolean).
Nullable extension dtypes preserve their dtype when nulls are introduced, unlike numpy dtypes which promote to float64.
Sourcepub const fn to_non_nullable(&self) -> Self
pub const fn to_non_nullable(&self) -> Self
Returns the non-nullable equivalent dtype.
For nullable extension dtypes, returns the numpy equivalent. For non-nullable dtypes, returns self.
Sourcepub const fn to_nullable(&self) -> Self
pub const fn to_nullable(&self) -> Self
Returns the nullable equivalent dtype.
For numpy int64/bool, returns the nullable extension dtype. For already-nullable or other dtypes, returns self.
Sourcepub const fn is_signed_integer(&self) -> bool
pub const fn is_signed_integer(&self) -> bool
Returns true if this is a signed integer type.
Matches pd.api.types.is_signed_integer_dtype().
Sourcepub const fn is_string_dtype(&self) -> bool
pub const fn is_string_dtype(&self) -> bool
Returns true if this is a string/object dtype.
Matches pd.api.types.is_string_dtype().
Sourcepub const fn is_any_real_numeric(&self) -> bool
pub const fn is_any_real_numeric(&self) -> bool
Returns true for any real numeric dtype (integer or float).
Matches pd.api.types.is_any_real_numeric_dtype().
Sourcepub const fn is_datetime_like(&self) -> bool
pub const fn is_datetime_like(&self) -> bool
Returns true for datetime-like dtypes (datetime, timedelta, period).
Matches pd.api.types.is_datetime64_any_dtype() family.
Sourcepub const fn char(&self) -> char
pub const fn char(&self) -> char
Return the numpy dtype character code.
Matches numpy dtype.char property.