DataFrame

Enum DataFrame 

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

Source

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 buf is not of the desired memory layout.
  • the buf is not fully consumed after loading.
Source§

impl<'a, T: AFloat> DataFrame<'a, T>

Source

pub fn to_bytes(&self) -> Result<Vec<u8>>

Source

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>

Source

pub fn save(&self, path: &str) -> Result<()>

Source

pub fn load(path: &str) -> Result<Self>

Source§

impl<'a, T: AFloat> DataFrame<'a, T>

Source

pub fn read(reader: &mut impl Read) -> Result<Self>

Source

pub fn write(&self, writer: &mut impl Write) -> Result<()>

Source§

impl<'a, T: AFloat> DataFrame<'a, T>

Source

pub fn new_view( index: ArrayView1<'a, IndexDtype>, columns: ArrayView1<'a, ColumnsDtype>, values: ArrayView2<'a, T>, ) -> Self

Source

pub fn new_owned( index: Array1<IndexDtype>, columns: Array1<ColumnsDtype>, values: Array2<T>, ) -> Self

Source

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, and T).
  • the ‘owners’ of the pointers should NOT be freed before the DataFrame is dropped.
Source

pub fn from_vec( index: Vec<IndexDtype>, columns: Vec<ColumnsDtype>, values: Vec<T>, ) -> Result<Self>

Source

pub fn index(&self) -> ArrayView1<'_, IndexDtype>

Source

pub fn columns(&self) -> ArrayView1<'_, ColumnsDtype>

Source

pub fn values(&self) -> ArrayView2<'_, T>

Source

pub fn is_owned(&self) -> bool

Source

pub fn into_owned(self) -> Self

Source§

impl<'a, T: AFloat> DataFrame<'a, T>

Source

pub fn nanmean_axis1(&self, num_threads: Option<usize>) -> Vec<T>

Source

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

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> Ungil for T
where T: Send,