pub struct DataFrame { /* private fields */ }Expand description
Internal columnar DataFrame for data storage and manipulation.
Implementations§
Source§impl DataFrame
impl DataFrame
Sourcepub fn column_names(&self) -> Vec<&str>
pub fn column_names(&self) -> Vec<&str>
Get column names.
Sourcepub fn has_column(&self, name: &str) -> bool
pub fn has_column(&self, name: &str) -> bool
Check if a column exists.
Sourcepub fn add_column(&mut self, name: String, values: Vec<Value>)
pub fn add_column(&mut self, name: String, values: Vec<Value>)
Add (or replace) a column.
Never panics. If the length doesn’t match the existing rows, the shorter
side is padded with Value::Na and the mismatch is recorded as an
issue: building or rendering a plot from this frame then
fails with GGError::ValidationError. Use
try_add_column to reject the column instead.
Sourcepub fn try_add_column(
&mut self,
name: String,
values: Vec<Value>,
) -> Result<(), GGError>
pub fn try_add_column( &mut self, name: String, values: Vec<Value>, ) -> Result<(), GGError>
Add (or replace) a column, rejecting a length mismatch with a
GGError::ValidationError (the frame is left unchanged).
Sourcepub fn issues(&self) -> &[String]
pub fn issues(&self) -> &[String]
Problems recorded while assembling this frame (empty when well-formed).
Sourcepub fn validate(&self) -> Result<(), GGError>
pub fn validate(&self) -> Result<(), GGError>
Ok when the frame is well-formed, else a GGError::ValidationError
describing every recorded issue.
Sourcepub fn column_mut(&mut self, name: &str) -> Option<&mut Vec<Value>>
pub fn column_mut(&mut self, name: &str) -> Option<&mut Vec<Value>>
Get a mutable reference to a column.
Sourcepub fn group_by(&self, keys: &[&str]) -> Vec<DataFrame>
pub fn group_by(&self, keys: &[&str]) -> Vec<DataFrame>
Group by one or more key columns. Returns a Vec of DataFrames, one per group.
Sourcepub fn sort_by(&self, column: &str) -> DataFrame
pub fn sort_by(&self, column: &str) -> DataFrame
Sort by a column (ascending). Returns a new DataFrame.
Sourcepub fn unique_values(&self, column: &str) -> Vec<Value>
pub fn unique_values(&self, column: &str) -> Vec<Value>
Get all unique values in a column.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DataFrame
impl RefUnwindSafe for DataFrame
impl Send for DataFrame
impl Sync for DataFrame
impl Unpin for DataFrame
impl UnsafeUnpin for DataFrame
impl UnwindSafe for DataFrame
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§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