Trait polars_core::chunked_array::ops::ChunkCast
source · pub trait ChunkCast {
// Required methods
fn cast_with_options(
&self,
data_type: &DataType,
options: CastOptions
) -> PolarsResult<Series>;
unsafe fn cast_unchecked(
&self,
data_type: &DataType
) -> PolarsResult<Series>;
// Provided method
fn cast(&self, data_type: &DataType) -> PolarsResult<Series> { ... }
}
Expand description
Cast ChunkedArray<T>
to ChunkedArray<N>
Required Methods§
sourcefn cast_with_options(
&self,
data_type: &DataType,
options: CastOptions
) -> PolarsResult<Series>
fn cast_with_options( &self, data_type: &DataType, options: CastOptions ) -> PolarsResult<Series>
Cast a ChunkedArray
to DataType
sourceunsafe fn cast_unchecked(&self, data_type: &DataType) -> PolarsResult<Series>
unsafe fn cast_unchecked(&self, data_type: &DataType) -> PolarsResult<Series>
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, data_type: &DataType) -> PolarsResult<Series>
fn cast(&self, data_type: &DataType) -> PolarsResult<Series>
Cast a ChunkedArray
to DataType
Implementors§
impl ChunkCast for BinaryChunked
impl ChunkCast for BinaryOffsetChunked
impl ChunkCast for BooleanChunked
impl ChunkCast for ListChunked
We cannot cast anything to or from List/LargeList So this implementation casts the inner type