pub enum DataFrame<'a, T: AFloat> {
View(DataFrameView<'a, T>),
Owned(OwnedDataFrame<T>),
}Variants§
View(DataFrameView<'a, T>)
Owned(OwnedDataFrame<T>)
Implementations§
Source§impl<'a, T: AFloat> DataFrame<'a, T>
impl<'a, T: AFloat> DataFrame<'a, T>
Sourcepub fn from_buffer(buf: impl Buf) -> Result<Self>
pub fn from_buffer(buf: impl Buf) -> Result<Self>
Create an owned DataFrame from a Buf, whose underlying bytes are returned from the DataFrame::to_bytes method.
Since the returned DataFrame is owned:
- it is safe to use it anyway you like.
- copying is occurred during this method.
If you want a zero-copy loading, you can try to use the DataFrame::from_bytes method with your Buf.
§Panics
This method will panic if:
- the bytes behind the
bufis not of the desired memory layout. - the
bufis not fully consumed after loading.
Source§impl<'a, T: AFloat> DataFrame<'a, T>
impl<'a, T: AFloat> DataFrame<'a, T>
pub fn to_bytes(&self) -> Result<Vec<u8>>
Sourcepub unsafe fn from_bytes(bytes: &'a [u8]) -> Result<Self>
pub unsafe fn from_bytes(bytes: &'a [u8]) -> Result<Self>
Create a DataFrame from a compact bytes slice, which is usually created by the DataFrame::to_bytes method.
The intention of this method is to create a ‘read-only’ DataFrame view. If you need
an owned DataFrame, you may call [DataFrame::to_owned] method on the returned DataFrame.
§Safety
The safety concern only comes from whether the bytes is of the desired memory layout,
the mutabilities are safe because we borrow the bytes immutably and specify the lifetime.
Source§impl<'a, T: AFloat> DataFrame<'a, T>
impl<'a, T: AFloat> DataFrame<'a, T>
pub fn new_view( index: ArrayView1<'a, IndexDtype>, columns: ArrayView1<'a, ColumnsDtype>, values: ArrayView2<'a, T>, ) -> Self
pub fn new_owned( index: Array1<IndexDtype>, columns: Array1<ColumnsDtype>, values: Array2<T>, ) -> Self
Sourcepub unsafe fn from_ptr(
index_ptr: *const u8,
index_shape: usize,
columns_ptr: *const u8,
columns_shape: usize,
values_ptr: *const u8,
) -> Self
pub unsafe fn from_ptr( index_ptr: *const u8, index_shape: usize, columns_ptr: *const u8, columns_shape: usize, values_ptr: *const u8, ) -> Self
§Safety
This function requires that:
- pointers are aligned with [
DF_ALIGN]. - pointers are representing the corresponding data types (i.e.,
IndexDtype,ColumnsDtype, andT). - the ‘owners’ of the pointers should NOT be freed before the
DataFrameis dropped.
pub fn from_vec( index: Vec<IndexDtype>, columns: Vec<ColumnsDtype>, values: Vec<T>, ) -> Result<Self>
pub fn index(&self) -> ArrayView1<'_, IndexDtype>
pub fn columns(&self) -> ArrayView1<'_, ColumnsDtype>
pub fn values(&self) -> ArrayView2<'_, T>
pub fn is_owned(&self) -> bool
pub fn into_owned(self) -> Self
Source§impl<'a, T: AFloat> DataFrame<'a, T>
impl<'a, T: AFloat> DataFrame<'a, T>
pub fn nanmean_axis1(&self, num_threads: Option<usize>) -> Vec<T>
pub fn nancorr_with_axis1( &self, other: ArrayView2<'_, T>, num_threads: Option<usize>, ) -> Vec<T>
Auto Trait Implementations§
impl<'a, T> Freeze for DataFrame<'a, T>
impl<'a, T> RefUnwindSafe for DataFrame<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for DataFrame<'a, T>
impl<'a, T> Sync for DataFrame<'a, T>
impl<'a, T> Unpin for DataFrame<'a, T>
impl<'a, T> UnwindSafe for DataFrame<'a, T>where
T: RefUnwindSafe,
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> 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