pub enum DType {
}Variants§
Null
Bool
BoolNullable
Nullable boolean extension dtype. Matches pandas BooleanDtype().
Int64
Int64Nullable
Nullable Int64 extension dtype. Matches pandas Int64Dtype() / pd.NA.
Float64
Float64Nullable
Nullable Float64 extension dtype. Matches pandas Float64Dtype() / pd.NA.
Distinct from DType::Float64 the way Int64Nullable is distinct from
Int64: same 8-byte payload, different missing value. MEASURED, live
pandas 2.2.3 — a Float64 lane stores pd.NA, and it does so even when
the input was an explicit NaN:
pd.Series([1.5, None], dtype="Float64")[1] -> <NA> (is pd.NA)
pd.Series([float("nan")], dtype="Float64")[0] -> <NA> COERCED
pd.Series([1.5, None])[1] -> nan (numpy)which is why Scalar::missing_for_dtype gives this dtype
NullKind::Null and gives Float64 NullKind::NaN.
The serde spelling is pandas’ spelling: float64 is the numpy dtype and
Float64 is the extension dtype, so this rename does NOT collide with
Float64 — the enum is rename_all = "snake_case", exactly as
Int64Nullable/Int64 already are. (br-frankenpandas-qkqfb)
Utf8
Categorical
Timedelta64
Datetime64
Nanosecond-precision datetime since Unix epoch.
A timezone is metadata shared by the whole column; values remain UTC nanoseconds in the contiguous datetime buffer.
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 fn to_non_nullable(&self) -> Self
pub 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 fn to_nullable(&self) -> Self
pub 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 for the Utf8 dtype.
⚠️ NARROWER THAN pd.api.types.is_string_dtype(), which the old wording
(“string/object dtype”) papered over. MEASURED, live pandas 2.2.3
(CrimsonPine 2026-08-19):
Series(['a','b']) object is_string_dtype TRUE
Series([1,2], dtype=object) object is_string_dtype FALSE
Series(Categorical(['a','b'])) category is_string_dtype TRUE
Series(['a','b'], dtype='string') string is_string_dtype TRUE
Series([1,2]) int64 is_string_dtype FALSESo pandas is NOT testing “object dtype”: an object column holding ints is
FALSE, and a CATEGORICAL column is TRUE. This returns true only for Utf8,
which means it disagrees with pandas on a categorical-of-strings.
Left as-is rather than widened: making this true for Categorical
unconditionally would be wrong for a categorical of non-strings, and this
enum carries no element type for its categories to test.
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.
Sourcepub const fn byteorder(&self) -> char
pub const fn byteorder(&self) -> char
Return the byte order character.
Matches numpy dtype.byteorder property. Returns ‘=’ (native) for all types.
Sourcepub const fn str_repr(&self) -> &'static str
pub const fn str_repr(&self) -> &'static str
Return the numpy dtype string representation.
Matches numpy dtype.str property.
Sourcepub const fn datetime64_naive() -> Self
pub const fn datetime64_naive() -> Self
Construct pandas’ timezone-naive datetime64[ns] dtype.
Sourcepub fn datetime64_tz(tz: impl Into<String>) -> Self
pub fn datetime64_tz(tz: impl Into<String>) -> Self
Construct a timezone-aware datetime64[ns, tz] dtype.
Sourcepub fn timezone(&self) -> Option<&str>
pub fn timezone(&self) -> Option<&str>
Return the column-level timezone carried by a datetime dtype.
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
Render the pandas dtype spelling, including a timezone when present.