pub enum Column {
Series(Series),
Scalar(ScalarColumn),
}
Expand description
A column within a DataFrame
.
This is lazily initialized to a Series
with methods like
as_materialized_series
and
take_materialized_series
.
Currently, there are two ways to represent a Column
.
- A
Series
of values - A
ScalarColumn
that repeats a singleScalar
Variants§
Series(Series)
Scalar(ScalarColumn)
Implementations§
Source§impl Column
impl Column
pub fn new<T, Phantom>(name: PlSmallStr, values: T) -> Column
pub fn new_empty(name: PlSmallStr, dtype: &DataType) -> Column
pub fn new_scalar(name: PlSmallStr, scalar: Scalar, length: usize) -> Column
Sourcepub fn as_materialized_series(&self) -> &Series
pub fn as_materialized_series(&self) -> &Series
Sourcepub fn into_materialized_series(&mut self) -> &mut Series
pub fn into_materialized_series(&mut self) -> &mut Series
Turn Column
into a Column::Series
.
This may need to materialize the Series
on the first invocation for a specific column.
Sourcepub fn take_materialized_series(self) -> Series
pub fn take_materialized_series(self) -> Series
pub fn dtype(&self) -> &DataType
pub fn field(&self) -> Cow<'_, Field>
pub fn name(&self) -> &PlSmallStr
pub fn len(&self) -> usize
pub fn with_name(self, name: PlSmallStr) -> Column
pub fn rename(&mut self, name: PlSmallStr)
pub fn as_series(&self) -> Option<&Series>
pub fn as_scalar_column(&self) -> Option<&ScalarColumn>
pub fn try_bool(&self) -> Option<&ChunkedArray<BooleanType>>
pub fn try_i8(&self) -> Option<&ChunkedArray<Int8Type>>
pub fn try_i16(&self) -> Option<&ChunkedArray<Int16Type>>
pub fn try_i32(&self) -> Option<&ChunkedArray<Int32Type>>
pub fn try_i64(&self) -> Option<&ChunkedArray<Int64Type>>
pub fn try_u8(&self) -> Option<&ChunkedArray<UInt8Type>>
pub fn try_u16(&self) -> Option<&ChunkedArray<UInt16Type>>
pub fn try_u32(&self) -> Option<&ChunkedArray<UInt32Type>>
pub fn try_u64(&self) -> Option<&ChunkedArray<UInt64Type>>
pub fn try_f32(&self) -> Option<&ChunkedArray<Float32Type>>
pub fn try_f64(&self) -> Option<&ChunkedArray<Float64Type>>
pub fn try_str(&self) -> Option<&ChunkedArray<StringType>>
pub fn try_list(&self) -> Option<&ChunkedArray<ListType>>
pub fn try_binary(&self) -> Option<&ChunkedArray<BinaryType>>
pub fn try_idx(&self) -> Option<&ChunkedArray<UInt32Type>>
pub fn try_binary_offset(&self) -> Option<&ChunkedArray<BinaryOffsetType>>
pub fn try_datetime(&self) -> Option<&Logical<DatetimeType, Int64Type>>
dtype-datetime
only.pub fn try_struct(&self) -> Option<&ChunkedArray<StructType>>
dtype-struct
only.pub fn try_decimal(&self) -> Option<&Logical<DecimalType, Int128Type>>
dtype-decimal
only.pub fn try_array(&self) -> Option<&ChunkedArray<FixedSizeListType>>
dtype-array
only.pub fn try_categorical(&self) -> Option<&CategoricalChunked>
dtype-categorical
only.pub fn try_date(&self) -> Option<&Logical<DateType, Int32Type>>
dtype-date
only.pub fn try_duration(&self) -> Option<&Logical<DurationType, Int64Type>>
dtype-duration
only.pub fn bool(&self) -> Result<&ChunkedArray<BooleanType>, PolarsError>
pub fn i8(&self) -> Result<&ChunkedArray<Int8Type>, PolarsError>
pub fn i16(&self) -> Result<&ChunkedArray<Int16Type>, PolarsError>
pub fn i32(&self) -> Result<&ChunkedArray<Int32Type>, PolarsError>
pub fn i64(&self) -> Result<&ChunkedArray<Int64Type>, PolarsError>
pub fn u8(&self) -> Result<&ChunkedArray<UInt8Type>, PolarsError>
pub fn u16(&self) -> Result<&ChunkedArray<UInt16Type>, PolarsError>
pub fn u32(&self) -> Result<&ChunkedArray<UInt32Type>, PolarsError>
pub fn u64(&self) -> Result<&ChunkedArray<UInt64Type>, PolarsError>
pub fn f32(&self) -> Result<&ChunkedArray<Float32Type>, PolarsError>
pub fn f64(&self) -> Result<&ChunkedArray<Float64Type>, PolarsError>
pub fn str(&self) -> Result<&ChunkedArray<StringType>, PolarsError>
pub fn list(&self) -> Result<&ChunkedArray<ListType>, PolarsError>
pub fn binary(&self) -> Result<&ChunkedArray<BinaryType>, PolarsError>
pub fn idx(&self) -> Result<&ChunkedArray<UInt32Type>, PolarsError>
pub fn binary_offset( &self, ) -> Result<&ChunkedArray<BinaryOffsetType>, PolarsError>
pub fn datetime(&self) -> Result<&Logical<DatetimeType, Int64Type>, PolarsError>
dtype-datetime
only.pub fn struct_(&self) -> Result<&ChunkedArray<StructType>, PolarsError>
dtype-struct
only.pub fn decimal(&self) -> Result<&Logical<DecimalType, Int128Type>, PolarsError>
dtype-decimal
only.pub fn array(&self) -> Result<&ChunkedArray<FixedSizeListType>, PolarsError>
dtype-array
only.pub fn categorical(&self) -> Result<&CategoricalChunked, PolarsError>
dtype-categorical
only.pub fn date(&self) -> Result<&Logical<DateType, Int32Type>, PolarsError>
dtype-date
only.pub fn duration(&self) -> Result<&Logical<DurationType, Int64Type>, PolarsError>
dtype-duration
only.pub fn cast_with_options( &self, dtype: &DataType, options: CastOptions, ) -> Result<Column, PolarsError>
pub fn strict_cast(&self, dtype: &DataType) -> Result<Column, PolarsError>
pub fn cast(&self, dtype: &DataType) -> Result<Column, PolarsError>
Sourcepub unsafe fn cast_unchecked(
&self,
dtype: &DataType,
) -> Result<Column, PolarsError>
pub unsafe fn cast_unchecked( &self, dtype: &DataType, ) -> Result<Column, PolarsError>
§Safety
This can lead to invalid memory access in downstream code.
pub fn clear(&self) -> Column
pub fn shrink_to_fit(&mut self)
pub fn new_from_index(&self, index: usize, length: usize) -> Column
pub fn has_nulls(&self) -> bool
pub fn is_null(&self) -> ChunkedArray<BooleanType>
pub fn is_not_null(&self) -> ChunkedArray<BooleanType>
pub fn to_physical_repr(&self) -> Column
pub fn head(&self, length: Option<usize>) -> Column
pub fn tail(&self, length: Option<usize>) -> Column
pub fn slice(&self, offset: i64, length: usize) -> Column
pub fn split_at(&self, offset: i64) -> (Column, Column)
pub fn null_count(&self) -> usize
pub fn take( &self, indices: &ChunkedArray<UInt32Type>, ) -> Result<Column, PolarsError>
pub fn take_slice(&self, indices: &[u32]) -> Result<Column, PolarsError>
Sourcepub unsafe fn take_unchecked(
&self,
indices: &ChunkedArray<UInt32Type>,
) -> Column
pub unsafe fn take_unchecked( &self, indices: &ChunkedArray<UInt32Type>, ) -> Column
§Safety
No bounds on the indexes are performed.
Sourcepub unsafe fn take_slice_unchecked(&self, indices: &[u32]) -> Column
pub unsafe fn take_slice_unchecked(&self, indices: &[u32]) -> Column
§Safety
No bounds on the indexes are performed.
Sourcepub unsafe fn agg_min(&self, groups: &GroupsProxy) -> Column
Available on crate feature algorithm_group_by
only.
pub unsafe fn agg_min(&self, groups: &GroupsProxy) -> Column
algorithm_group_by
only.§Safety
Does no bounds checks, groups must be correct.
Sourcepub unsafe fn agg_max(&self, groups: &GroupsProxy) -> Column
Available on crate feature algorithm_group_by
only.
pub unsafe fn agg_max(&self, groups: &GroupsProxy) -> Column
algorithm_group_by
only.§Safety
Does no bounds checks, groups must be correct.
Sourcepub unsafe fn agg_mean(&self, groups: &GroupsProxy) -> Column
Available on crate feature algorithm_group_by
only.
pub unsafe fn agg_mean(&self, groups: &GroupsProxy) -> Column
algorithm_group_by
only.§Safety
Does no bounds checks, groups must be correct.
Sourcepub unsafe fn agg_sum(&self, groups: &GroupsProxy) -> Column
Available on crate feature algorithm_group_by
only.
pub unsafe fn agg_sum(&self, groups: &GroupsProxy) -> Column
algorithm_group_by
only.§Safety
Does no bounds checks, groups must be correct.
Sourcepub unsafe fn agg_first(&self, groups: &GroupsProxy) -> Column
Available on crate feature algorithm_group_by
only.
pub unsafe fn agg_first(&self, groups: &GroupsProxy) -> Column
algorithm_group_by
only.§Safety
Does no bounds checks, groups must be correct.
Sourcepub unsafe fn agg_last(&self, groups: &GroupsProxy) -> Column
Available on crate feature algorithm_group_by
only.
pub unsafe fn agg_last(&self, groups: &GroupsProxy) -> Column
algorithm_group_by
only.§Safety
Does no bounds checks, groups must be correct.
Sourcepub unsafe fn agg_n_unique(&self, groups: &GroupsProxy) -> Column
Available on crate feature algorithm_group_by
only.
pub unsafe fn agg_n_unique(&self, groups: &GroupsProxy) -> Column
algorithm_group_by
only.§Safety
Does no bounds checks, groups must be correct.
Sourcepub unsafe fn agg_quantile(
&self,
groups: &GroupsProxy,
quantile: f64,
method: QuantileMethod,
) -> Column
Available on crate feature algorithm_group_by
only.
pub unsafe fn agg_quantile( &self, groups: &GroupsProxy, quantile: f64, method: QuantileMethod, ) -> Column
algorithm_group_by
only.§Safety
Does no bounds checks, groups must be correct.
Sourcepub unsafe fn agg_median(&self, groups: &GroupsProxy) -> Column
Available on crate feature algorithm_group_by
only.
pub unsafe fn agg_median(&self, groups: &GroupsProxy) -> Column
algorithm_group_by
only.§Safety
Does no bounds checks, groups must be correct.
Sourcepub unsafe fn agg_var(&self, groups: &GroupsProxy, ddof: u8) -> Column
Available on crate feature algorithm_group_by
only.
pub unsafe fn agg_var(&self, groups: &GroupsProxy, ddof: u8) -> Column
algorithm_group_by
only.§Safety
Does no bounds checks, groups must be correct.
Sourcepub unsafe fn agg_list(&self, groups: &GroupsProxy) -> Column
Available on crate feature algorithm_group_by
only.
pub unsafe fn agg_list(&self, groups: &GroupsProxy) -> Column
algorithm_group_by
only.§Safety
Does no bounds checks, groups must be correct.
pub fn full_null(name: PlSmallStr, size: usize, dtype: &DataType) -> Column
pub fn is_empty(&self) -> bool
pub fn reverse(&self) -> Column
pub fn equals(&self, right: &Column) -> bool
pub fn equals_missing(&self, right: &Column) -> bool
pub fn set_sorted_flag(&mut self, sorted: IsSorted)
pub fn get_flags(&self) -> MetadataFlags
pub fn get_metadata<'a>(&'a self) -> Option<Box<dyn MetadataTrait + 'a>>
pub fn get_data_ptr(&self) -> usize
pub fn vec_hash( &self, build_hasher: RandomState, buf: &mut Vec<u64>, ) -> Result<(), PolarsError>
pub fn vec_hash_combine( &self, build_hasher: RandomState, hashes: &mut [u64], ) -> Result<(), PolarsError>
pub fn append(&mut self, other: &Column) -> Result<&mut Column, PolarsError>
pub fn arg_sort(&self, options: SortOptions) -> ChunkedArray<UInt32Type>
pub fn bit_repr(&self) -> Option<BitRepr>
pub fn into_frame(self) -> DataFrame
pub fn unique_stable(&self) -> Result<Column, PolarsError>
pub fn extend(&mut self, other: &Column) -> Result<&mut Column, PolarsError>
pub fn rechunk(&self) -> Column
pub fn explode(&self) -> Result<Column, PolarsError>
pub fn fill_null( &self, strategy: FillNullStrategy, ) -> Result<Column, PolarsError>
pub fn divide(&self, rhs: &Column) -> Result<Column, PolarsError>
pub fn shift(&self, periods: i64) -> Column
pub fn zip_with( &self, mask: &ChunkedArray<BooleanType>, other: &Column, ) -> Result<Column, PolarsError>
zip_with
only.pub fn zip_with_same_type( &self, mask: &ChunkedArray<BooleanType>, other: &Column, ) -> Result<Column, PolarsError>
zip_with
only.pub fn drop_nulls(&self) -> Column
pub fn is_sorted_flag(&self) -> IsSorted
pub fn unique(&self) -> Result<Column, PolarsError>
pub fn reshape_list( &self, dimensions: &[ReshapeDimension], ) -> Result<Column, PolarsError>
pub fn reshape_array( &self, dimensions: &[ReshapeDimension], ) -> Result<Column, PolarsError>
dtype-array
only.pub fn sort(&self, sort_options: SortOptions) -> Result<Column, PolarsError>
pub fn filter( &self, filter: &ChunkedArray<BooleanType>, ) -> Result<Column, PolarsError>
pub fn shuffle(&self, seed: Option<u64>) -> Column
random
only.pub fn sample_frac( &self, frac: f64, with_replacement: bool, shuffle: bool, seed: Option<u64>, ) -> Result<Column, PolarsError>
random
only.pub fn sample_n( &self, n: usize, with_replacement: bool, shuffle: bool, seed: Option<u64>, ) -> Result<Column, PolarsError>
random
only.pub fn gather_every(&self, n: usize, offset: usize) -> Column
pub fn extend_constant( &self, value: AnyValue<'_>, n: usize, ) -> Result<Column, PolarsError>
pub fn is_finite(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
pub fn is_infinite(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
pub fn is_nan(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
pub fn is_not_nan(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
pub fn wrapping_trunc_div_scalar<T>(&self, rhs: T) -> Column
pub fn product(&self) -> Result<Scalar, PolarsError>
pub fn phys_iter(&self) -> Box<dyn ExactSizeIterator<Item = AnyValue<'_>> + '_>
pub fn get(&self, index: usize) -> Result<AnyValue<'_>, PolarsError>
Sourcepub unsafe fn get_unchecked(&self, index: usize) -> AnyValue<'_>
pub unsafe fn get_unchecked(&self, index: usize) -> AnyValue<'_>
§Safety
Does not perform bounds check on index
pub fn get_object( &self, index: usize, ) -> Option<&(dyn PolarsObjectSafe + 'static)>
object
only.pub fn bitand(&self, rhs: &Column) -> Result<Column, PolarsError>
pub fn max_reduce(&self) -> Result<Scalar, PolarsError>
pub fn min_reduce(&self) -> Result<Scalar, PolarsError>
pub fn apply_unary_elementwise(&self, f: impl Fn(&Series) -> Series) -> Column
pub fn try_apply_unary_elementwise( &self, f: impl Fn(&Series) -> Result<Series, PolarsError>, ) -> Result<Column, PolarsError>
Trait Implementations§
Source§impl ChunkCompareEq<&Column> for Column
impl ChunkCompareEq<&Column> for Column
Source§fn equal(&self, rhs: &Column) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn equal(&self, rhs: &Column) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking for equality.
Source§fn equal_missing(
&self,
rhs: &Column,
) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn equal_missing( &self, rhs: &Column, ) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking for equality.
Source§fn not_equal(
&self,
rhs: &Column,
) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn not_equal( &self, rhs: &Column, ) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking for inequality.
Source§fn not_equal_missing(
&self,
rhs: &Column,
) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn not_equal_missing( &self, rhs: &Column, ) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking for inequality.
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§impl ChunkCompareIneq<&Column> for Column
impl ChunkCompareIneq<&Column> for Column
Source§fn gt(&self, rhs: &Column) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn gt(&self, rhs: &Column) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking if self > rhs.
Source§fn gt_eq(&self, rhs: &Column) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn gt_eq(&self, rhs: &Column) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking if self >= rhs.
Source§fn lt(&self, rhs: &Column) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn lt(&self, rhs: &Column) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking if self < rhs.
Source§fn lt_eq(&self, rhs: &Column) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn lt_eq(&self, rhs: &Column) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking if self <= rhs.
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§impl From<ScalarColumn> for Column
impl From<ScalarColumn> for Column
Source§fn from(value: ScalarColumn) -> Column
fn from(value: ScalarColumn) -> Column
Source§impl FromIterator<Column> for DataFrame
impl FromIterator<Column> for DataFrame
Source§impl IntoColumn for Column
impl IntoColumn for Column
fn into_column(self) -> Column
Auto Trait Implementations§
impl !Freeze for Column
impl !RefUnwindSafe for Column
impl Send for Column
impl Sync for Column
impl Unpin for Column
impl !UnwindSafe for Column
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