Skip to main content

Column

Struct Column 

Source
pub struct Column { /* private fields */ }
Expand description

A single named column with homogeneous type.

Implementations§

Source§

impl Column

Source

pub fn new_bool(name: impl Into<String>, data: Vec<Option<bool>>) -> Self

Create a boolean column with nullable values.

Source

pub fn new_i64(name: impl Into<String>, data: Vec<Option<i64>>) -> Self

Create an i64 column with nullable values.

Source

pub fn new_u64(name: impl Into<String>, data: Vec<Option<u64>>) -> Self

Create a u64 column with nullable values.

Source

pub fn new_f64(name: impl Into<String>, data: Vec<Option<f64>>) -> Self

Create an f64 column with nullable values.

Source

pub fn new_string(name: impl Into<String>, data: Vec<Option<String>>) -> Self

Create a string column with nullable values.

Source

pub fn from_bools(name: impl Into<String>, data: Vec<bool>) -> Self

Create a boolean column from non-nullable values.

Source

pub fn from_i64s(name: impl Into<String>, data: Vec<i64>) -> Self

Create an i64 column from non-nullable values.

Source

pub fn from_u64s(name: impl Into<String>, data: Vec<u64>) -> Self

Create a u64 column from non-nullable values.

Source

pub fn from_f64s(name: impl Into<String>, data: Vec<f64>) -> Self

Create an f64 column from non-nullable values.

Source

pub fn from_strings(name: impl Into<String>, data: Vec<String>) -> Self

Create a string column from owned strings (non-nullable).

Source

pub fn from_strs(name: impl Into<String>, data: &[&str]) -> Self

Create a string column from string slices (non-nullable).

Source

pub fn name(&self) -> &str

Column name.

Source

pub fn dtype(&self) -> DataType

Data type of this column.

Source

pub fn len(&self) -> usize

Number of elements (including nulls).

Source

pub fn is_empty(&self) -> bool

Whether the column is empty.

Source

pub fn non_null_count(&self) -> usize

Count of non-null values.

Source

pub fn null_count(&self) -> usize

Count of null values.

Source

pub fn data(&self) -> &ColumnData

Get the underlying data reference.

Source

pub fn get(&self, index: usize) -> Option<Scalar>

Get value at index as Scalar. Returns None if index out of bounds.

Source

pub fn rename(&self, name: impl Into<String>) -> Self

Rename this column (returns a new column).

Source

pub fn take(&self, indices: &[usize]) -> Self

Take rows at specified indices.

Source

pub fn take_optional(&self, indices: &[Option<usize>]) -> Self

Take rows at optional indices. None produces null values. Used by join operations where one side may have no matching row.

Source

pub fn as_str_iter( &self, ) -> Result<impl Iterator<Item = Option<&str>>, DataFrameError>

Iterate as string references. Returns Err if column is not Utf8.

Source

pub fn as_i64_iter( &self, ) -> Result<impl Iterator<Item = Option<i64>> + '_, DataFrameError>

Iterate as i64 values. Returns Err if column is not Int64.

Source

pub fn as_u64_iter( &self, ) -> Result<impl Iterator<Item = Option<u64>> + '_, DataFrameError>

Iterate as u64 values. Returns Err if column is not UInt64.

Source

pub fn as_f64_iter( &self, ) -> Result<impl Iterator<Item = Option<f64>> + '_, DataFrameError>

Iterate as f64 values. Returns Err if column is not Float64.

Source

pub fn as_bool_iter( &self, ) -> Result<impl Iterator<Item = Option<bool>> + '_, DataFrameError>

Iterate as bool values. Returns Err if column is not Bool.

Source

pub fn get_str(&self, index: usize) -> Result<Option<&str>, DataFrameError>

Get a string value at index. Returns Err if not Utf8 column.

Source§

impl Column

Source

pub fn sum(&self) -> Scalar

Sum of non-null numeric values. Returns Null for empty/non-numeric columns.

Source

pub fn mean(&self) -> Scalar

Mean of non-null numeric values. Returns Null if no non-null values.

Source

pub fn min(&self) -> Scalar

Minimum non-null value. Returns Null if no non-null values.

Source

pub fn max(&self) -> Scalar

Maximum non-null value. Returns Null if no non-null values.

Source

pub fn median(&self) -> Scalar

Median of non-null numeric values. Returns Null if no non-null values.

Source

pub fn std_dev(&self) -> Scalar

Standard deviation (population) of non-null numeric values.

Source

pub fn n_unique(&self) -> usize

Count of unique non-null values.

Source

pub fn first(&self) -> Scalar

First non-null value in the column.

Source

pub fn last(&self) -> Scalar

Last non-null value in the column.

Source

pub fn quantile(&self, q: f64) -> Result<Scalar, DataFrameError>

Get a quantile (0.0 to 1.0) from non-null numeric values.

Trait Implementations§

Source§

impl Clone for Column

Source§

fn clone(&self) -> Column

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Column

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.