pub struct DataFrame { /* private fields */ }Expand description
Ordered named host columns with one checked row count.
let mut frame = oa::DataFrame::new();
frame.set_column("timestamp", oa::Series::I64(vec![0, 1]))?;
frame.set_column("close", oa::Series::F64(vec![10.0, 11.0]))?;
let last = frame.slice(1..2)?;
assert_eq!(last.len(), 1);Unlike the donor, missing columns and unequal lengths are errors. Whole-column replacement is transactional; exclusive mutable slices cannot invalidate lengths.
Implementations§
Source§impl DataFrame
impl DataFrame
Sourcepub fn set_column(
&mut self,
name: impl Into<String>,
series: Series,
) -> Result<()>
pub fn set_column( &mut self, name: impl Into<String>, series: Series, ) -> Result<()>
Insert or replace a column, moving its buffer without copying.
§Errors
Rejects empty names and lengths differing from existing columns.
Sourcepub fn column(&self, name: &str) -> Result<SeriesView<'_>>
pub fn column(&self, name: &str) -> Result<SeriesView<'_>>
Sourcepub fn column_mut(&mut self, name: &str) -> Result<SeriesViewMut<'_>>
pub fn column_mut(&mut self, name: &str) -> Result<SeriesViewMut<'_>>
Exclusively borrow column values for in-place edits. Length cannot change. Existing immutable frame/OHLCV views prevent this borrow in safe Rust.
§Errors
Returns an error when the column does not exist.
Sourcepub fn column_names(&self) -> impl ExactSizeIterator<Item = &str>
pub fn column_names(&self) -> impl ExactSizeIterator<Item = &str>
Column names in insertion order.
Trait Implementations§
Auto Trait Implementations§
impl Forget for DataFrame
impl Freeze for DataFrame
impl Move for DataFrame
impl RefUnwindSafe for DataFrame
impl Send for DataFramewhere
RawVecInner: Send,
impl Sync for DataFramewhere
RawVecInner: Sync,
impl Unpin for DataFrame
impl UnsafeUnpin for DataFrame
impl UnwindSafe for DataFramewhere
RawVecInner: UnwindSafe,
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