pub struct ScalarColumn { /* private fields */ }
Expand description
Implementations§
Source§impl ScalarColumn
impl ScalarColumn
pub fn new(name: PlSmallStr, scalar: Scalar, length: usize) -> ScalarColumn
pub fn new_empty(name: PlSmallStr, dtype: DataType) -> ScalarColumn
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 as_n_values_series(&self, n: usize) -> Series
pub fn as_n_values_series(&self, n: usize) -> Series
Take the ScalarColumn
as a series with a n
values.
If the ScalarColumn
has length=0
the resulting Series
will also have length=0
.
Sourcepub fn unit_scalar_from_series(series: Series) -> ScalarColumn
pub fn unit_scalar_from_series(series: Series) -> ScalarColumn
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) -> ScalarColumn
pub fn from_single_value_series(series: Series, length: usize) -> ScalarColumn
Create a new ScalarColumn
from a length=1
Series and expand it length
.
This will panic if the value cannot be made static.
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, ) -> Result<ScalarColumn, PolarsError>
pub fn strict_cast(&self, dtype: &DataType) -> Result<ScalarColumn, PolarsError>
pub fn cast(&self, dtype: &DataType) -> Result<ScalarColumn, PolarsError>
Sourcepub unsafe fn cast_unchecked(
&self,
dtype: &DataType,
) -> Result<ScalarColumn, PolarsError>
pub unsafe fn cast_unchecked( &self, dtype: &DataType, ) -> Result<ScalarColumn, PolarsError>
§Safety
This can lead to invalid memory access in downstream code.
pub fn rename(&mut self, name: PlSmallStr) -> &mut ScalarColumn
pub fn has_nulls(&self) -> bool
pub fn drop_nulls(&self) -> ScalarColumn
pub fn into_nulls(self) -> ScalarColumn
pub fn map_scalar(&mut self, map_scalar: impl Fn(Scalar) -> Scalar)
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<'de> Deserialize<'de> for ScalarColumn
impl<'de> Deserialize<'de> for ScalarColumn
Source§fn deserialize<D>(
deserializer: D,
) -> Result<ScalarColumn, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ScalarColumn, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl From<ScalarColumn> for Column
impl From<ScalarColumn> for Column
Source§fn from(value: ScalarColumn) -> Column
fn from(value: ScalarColumn) -> Column
Source§impl IntoColumn for ScalarColumn
impl IntoColumn for ScalarColumn
fn into_column(self) -> Column
Source§impl Serialize for ScalarColumn
impl Serialize for ScalarColumn
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl TryFrom<SerializeWrap> for ScalarColumn
impl TryFrom<SerializeWrap> for ScalarColumn
Source§type Error = PolarsError
type Error = PolarsError
Source§fn try_from(
value: SerializeWrap,
) -> Result<ScalarColumn, <ScalarColumn as TryFrom<SerializeWrap>>::Error>
fn try_from( value: SerializeWrap, ) -> Result<ScalarColumn, <ScalarColumn as TryFrom<SerializeWrap>>::Error>
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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