Skip to main content

Dataset

Struct Dataset 

Source
pub struct Dataset { /* private fields */ }
Available on crate feature data only.
Expand description

A typed table: columns of equal length with dataset metadata.

§Example

use crisol_core::data::Dataset;

Implementations§

Source§

impl Dataset

Source

pub fn new() -> Self

An empty dataset.

Source

pub fn from_columns(columns: impl IntoIterator<Item = Column>) -> Self

A dataset from columns. The longest column sets the row count; shorter columns are treated as invalid at the end.

Source

pub fn with_rows(rows: usize) -> Self

A dataset with rows empty rows and no columns.

Source

pub fn row_count(&self) -> usize

Number of rows.

Source

pub fn width(&self) -> usize

Number of columns.

Source

pub fn is_empty(&self) -> bool

Whether the dataset has no columns and no rows.

Source

pub fn columns(&self) -> &[Column]

The columns.

Source

pub fn column(&self, index: usize) -> Option<&Column>

A column by index.

Source

pub fn column_named(&self, name: &str) -> Option<&Column>

A column by name.

Source

pub fn index_of(&self, name: &str) -> Option<usize>

A column index by name.

Source

pub fn metadata(&self) -> &BTreeMap<String, String>

The dataset metadata.

Source

pub fn set_metadata(&mut self, key: impl Into<String>, value: impl Into<String>)

Add or replace metadata.

Source

pub fn lineage(&self) -> &Lineage

The dataset lineage.

Source

pub fn record_lineage(&mut self, step: LineageStep)

Record one transformation.

Source

pub fn derived_from( &mut self, source: impl Into<String>, operation: impl Into<String>, )

Record a source and operation.

Source

pub fn push_column(&mut self, column: Column)

Append a column, padding shorter existing columns with nulls.

Source

pub fn cell(&self, row: usize, column: usize) -> CellValue<'_>

A cell by row and column.

Source

pub fn row(&self, row: usize) -> Vec<DataValue>

The row as owned values, for a query or a channel.

Source

pub fn slice(&self, range: Range<usize>) -> Self

A dataset of rows in range.

Source

pub fn matching_rows( &self, predicate: impl FnMut(usize, &Self) -> bool, ) -> Vec<usize>

Rows whose predicate returns true, in order.

Source

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

A dataset with only rows, in the given order.

Source

pub fn xy_pairs(&self, x: &str, y: &str) -> Option<Vec<[f64; 2]>>

Points from two numeric columns, skipping null or non-numeric rows.

Source

pub fn point_at_row(&self, x: &str, y: &str, row: usize) -> Option<[f64; 2]>

One (x, y) point at row, when both values are finite numbers.

Source

pub fn rows_in_bounds(&self, x: &str, y: &str, bounds: Bounds) -> Vec<usize>

Rows whose two numeric columns fall inside bounds.

Source

pub fn stats(&self, column: usize) -> Option<ColumnStats>

Statistics for one column: count, min, max, mean, and nulls.

Trait Implementations§

Source§

impl Clone for Dataset

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Dataset

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Dataset

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Dataset

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Dataset

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Dataset

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Dataset

Auto Trait Implementations§

§

impl Forget for Dataset

§

impl Freeze for Dataset
where *const u8 is !null: Freeze, PhantomData<Column>: Freeze, *const LeafNode<String, String> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, String)>>: Freeze, PhantomData<LineageStep>: Freeze,

§

impl Move for Dataset

§

impl RefUnwindSafe for Dataset

§

impl Send for Dataset
where RawVecInner: Send, Arc<[f64]>: Send, Arc<[i64]>: Send, Arc<[bool]>: Send, Arc<[String]>: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send,

§

impl Sync for Dataset
where RawVecInner: Sync, Arc<[f64]>: Sync, Arc<[i64]>: Sync, Arc<[bool]>: Sync, Arc<[String]>: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync,

§

impl Unpin for Dataset
where *const u8 is !null: Unpin, Arc<[f64]>: Unpin, Arc<[i64]>: Unpin, Arc<[bool]>: Unpin, Arc<[String]>: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin,

§

impl UnsafeUnpin for Dataset

§

impl UnwindSafe for Dataset

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

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

Source§

fn align() -> usize

The alignment necessary for the key. Must return a power of two.
Source§

fn size(&self) -> usize

The size of the key in bytes.
Source§

unsafe fn init(&self, ptr: *mut u8)

Initialize the key in the given memory location. Read more
Source§

unsafe fn get<'a>(ptr: *const u8) -> &'a T

Get a reference to the key from the given memory location. Read more
Source§

unsafe fn drop_in_place(ptr: *mut u8)

Drop the key in place. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.