polars_core::chunked_array::ops

Trait ChunkCast

Source
pub trait ChunkCast {
    // Required methods
    fn cast_with_options(
        &self,
        dtype: &DataType,
        options: CastOptions,
    ) -> PolarsResult<Series>;
    unsafe fn cast_unchecked(&self, dtype: &DataType) -> PolarsResult<Series>;

    // Provided method
    fn cast(&self, dtype: &DataType) -> PolarsResult<Series> { ... }
}
Expand description

Cast ChunkedArray<T> to ChunkedArray<N>

Required Methods§

Source

fn cast_with_options( &self, dtype: &DataType, options: CastOptions, ) -> PolarsResult<Series>

Source

unsafe fn cast_unchecked(&self, dtype: &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§

Source

fn cast(&self, dtype: &DataType) -> PolarsResult<Series>

Implementors§

Source§

impl ChunkCast for BinaryChunked

Source§

impl ChunkCast for BinaryOffsetChunked

Source§

impl ChunkCast for BooleanChunked

Source§

impl ChunkCast for ListChunked

We cannot cast anything to or from List/LargeList So this implementation casts the inner type

Source§

impl ChunkCast for StringChunked

Source§

impl<T> ChunkCast for ChunkedArray<T>