pub trait ChunkCast {
// Required methods
fn cast_with_options(
&self,
dtype: &DataType,
options: CastOptions,
) -> Result<Series, PolarsError>;
unsafe fn cast_unchecked(
&self,
dtype: &DataType,
) -> Result<Series, PolarsError>;
// Provided method
fn cast(&self, dtype: &DataType) -> Result<Series, PolarsError> { ... }
}
Expand description
Cast ChunkedArray<T>
to ChunkedArray<N>
Required Methods§
Sourcefn cast_with_options(
&self,
dtype: &DataType,
options: CastOptions,
) -> Result<Series, PolarsError>
fn cast_with_options( &self, dtype: &DataType, options: CastOptions, ) -> Result<Series, PolarsError>
Cast a ChunkedArray
to DataType
Sourceunsafe fn cast_unchecked(&self, dtype: &DataType) -> Result<Series, PolarsError>
unsafe fn cast_unchecked(&self, dtype: &DataType) -> Result<Series, PolarsError>
Does not check if the cast is a valid one and may over/underflow
§Safety
- This doesn’t do utf8 validation checking when casting from binary
- This doesn’t do categorical bound checking when casting from UInt32
Provided Methods§
Sourcefn cast(&self, dtype: &DataType) -> Result<Series, PolarsError>
fn cast(&self, dtype: &DataType) -> Result<Series, PolarsError>
Cast a ChunkedArray
to DataType
Implementors§
impl ChunkCast for ChunkedArray<BinaryOffsetType>
impl ChunkCast for ChunkedArray<BinaryType>
impl ChunkCast for ChunkedArray<BooleanType>
impl ChunkCast for ChunkedArray<FixedSizeListType>
Available on crate feature
dtype-array
only.We cannot cast anything to or from List/LargeList So this implementation casts the inner type
impl ChunkCast for ChunkedArray<ListType>
We cannot cast anything to or from List/LargeList So this implementation casts the inner type