pub struct DataFrame { /* private fields */ }Expand description
A simple DataFrame representation for HTML rendering
§Examples
use ruchy::notebook::dataframe::DataFrame;
let df = DataFrame::new(
vec!["Name".to_string(), "Age".to_string()],
vec![
vec!["Alice".to_string(), "30".to_string()],
vec!["Bob".to_string(), "25".to_string()],
]
);
assert_eq!(df.row_count(), 2);
assert_eq!(df.column_count(), 2);Implementations§
Source§impl DataFrame
impl DataFrame
Sourcepub fn new(columns: Vec<String>, rows: Vec<Vec<String>>) -> Self
pub fn new(columns: Vec<String>, rows: Vec<Vec<String>>) -> Self
Create a new DataFrame with auto-detected column types
§Examples
use ruchy::notebook::dataframe::DataFrame;
let df = DataFrame::new(
vec!["ID".to_string(), "Value".to_string()],
vec![vec!["1".to_string(), "100".to_string()]]
);
assert_eq!(df.column_count(), 2);Sourcepub fn with_types(
columns: Vec<String>,
rows: Vec<Vec<String>>,
column_types: Vec<ColumnType>,
) -> Self
pub fn with_types( columns: Vec<String>, rows: Vec<Vec<String>>, column_types: Vec<ColumnType>, ) -> Self
Create a DataFrame with explicit column types
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Get the number of columns
Sourcepub fn column_types(&self) -> &[ColumnType]
pub fn column_types(&self) -> &[ColumnType]
Get column types
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 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 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>
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