pub struct ScalarColumn { /* private fields */ }
Expand description
Implementations§
Source§impl ScalarColumn
impl ScalarColumn
pub fn new(name: PlSmallStr, scalar: Scalar, length: usize) -> Self
pub fn new_empty(name: PlSmallStr, dtype: DataType) -> Self
pub fn name(&self) -> &PlSmallStr
pub fn scalar(&self) -> &Scalar
pub fn dtype(&self) -> &DataType
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn to_series(&self) -> Series
pub fn to_series(&self) -> Series
Materialize the ScalarColumn
into a Series
.
Sourcepub fn lazy_as_materialized_series(&self) -> Option<&Series>
pub fn lazy_as_materialized_series(&self) -> Option<&Series>
Get the ScalarColumn
as Series
if it was already materialized.
Sourcepub fn as_materialized_series(&self) -> &Series
pub fn as_materialized_series(&self) -> &Series
Get the ScalarColumn
as Series
This needs to materialize upon the first call. Afterwards, this is cached.
Sourcepub fn take_materialized_series(self) -> Series
pub fn take_materialized_series(self) -> Series
Take the ScalarColumn
and materialize as a Series
if not already done.
Sourcepub fn as_single_value_series(&self) -> Series
pub fn as_single_value_series(&self) -> Series
Take the ScalarColumn
as a series with a single value.
If the ScalarColumn
has length=0
the resulting Series
will also have length=0
.
Sourcepub fn unit_scalar_from_series(series: Series) -> Self
pub fn unit_scalar_from_series(series: Series) -> Self
Create a new ScalarColumn
from a length=1
Series and expand it length
.
This will panic if the value cannot be made static or if the series has length 0
.
Sourcepub fn from_single_value_series(series: Series, length: usize) -> Self
pub fn from_single_value_series(series: Series, length: usize) -> Self
Create a new ScalarColumn
from a length=1
Series and expand it length
.
This will panic if the value cannot be made static or if the series has length 0
.
Sourcepub fn resize(&self, length: usize) -> ScalarColumn
pub fn resize(&self, length: usize) -> ScalarColumn
Resize the ScalarColumn
to new length
.
This reuses the materialized Series
, if length <= self.length
.
pub fn cast_with_options( &self, dtype: &DataType, options: CastOptions, ) -> PolarsResult<Self>
pub fn strict_cast(&self, dtype: &DataType) -> PolarsResult<Self>
pub fn cast(&self, dtype: &DataType) -> PolarsResult<Self>
Sourcepub unsafe fn cast_unchecked(&self, dtype: &DataType) -> PolarsResult<Self>
pub unsafe fn cast_unchecked(&self, dtype: &DataType) -> PolarsResult<Self>
§Safety
This can lead to invalid memory access in downstream code.
pub fn rename(&mut self, name: PlSmallStr) -> &mut Self
pub fn has_nulls(&self) -> bool
Trait Implementations§
Source§impl Clone for ScalarColumn
impl Clone for ScalarColumn
Source§fn clone(&self) -> ScalarColumn
fn clone(&self) -> ScalarColumn
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ScalarColumn
impl Debug for ScalarColumn
Source§impl From<ScalarColumn> for Column
impl From<ScalarColumn> for Column
Source§fn from(value: ScalarColumn) -> Self
fn from(value: ScalarColumn) -> Self
Source§impl IntoColumn for ScalarColumn
impl IntoColumn for ScalarColumn
fn into_column(self) -> Column
Auto Trait Implementations§
impl !Freeze for ScalarColumn
impl !RefUnwindSafe for ScalarColumn
impl Send for ScalarColumn
impl Sync for ScalarColumn
impl Unpin for ScalarColumn
impl !UnwindSafe for ScalarColumn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more