pub struct DataFrame<T>where
T: UtahNum,{
pub columns: Vec<String>,
pub data: Matrix<T>,
pub index: Vec<String>,
}Expand description
A read-only dataframe.
Fields§
§columns: Vec<String>§data: Matrix<T>§index: Vec<String>Trait Implementations§
Source§impl<'a, T> Constructor<'a, T> for DataFrame<T>where
T: UtahNum + 'a,
impl<'a, T> Constructor<'a, T> for DataFrame<T>where
T: UtahNum + 'a,
Source§fn new<U: Clone>(data: Matrix<U>) -> DataFrame<T>where
T: From<U>,
fn new<U: Clone>(data: Matrix<U>) -> DataFrame<T>where
T: From<U>,
Create a new dataframe. The only required argument is data to populate the dataframe.
By default, the columns and index of the dataframe are ["1", "2", "3"..."N"], where N is
the number of columns (or rows) in the data.
use utah::prelude::*;
let a = arr2(&[[2.0, 7.0], [3.0, 4.0]]);
let df : DataFrame<f64> = DataFrame::new(a);When populating the dataframe with mixed-types, wrap the elements with InnerType enum:
use utah::prelude::*;
let a = arr2(&[[InnerType::Float(2.0), InnerType::Str("ak".into())],
[InnerType::Int32(6), InnerType::Int64(10)]]);
let df : DataFrame<InnerType> = DataFrame::new(a);Source§fn from_array<U: Clone>(data: Row<U>, axis: UtahAxis) -> DataFrame<T>where
T: From<U>,
fn from_array<U: Clone>(data: Row<U>, axis: UtahAxis) -> DataFrame<T>where
T: From<U>,
Generate a 1-dimensional DataFrame from an 1-D array of data.
When populating the dataframe with mixed-types, wrap the elements with InnerType enum.
use utah::prelude::*;
let a = arr1(&[2.0, 7.0]);
let df : DataFrame<f64> = DataFrame::from_array(a, UtahAxis::Column);Source§fn columns<U: Clone>(self, columns: &'a [U]) -> Result<DataFrame<T>>
fn columns<U: Clone>(self, columns: &'a [U]) -> Result<DataFrame<T>>
Populate the dataframe with a set of columns. The column elements can be any of OuterType. Example:
use utah::prelude::*;
let a = arr2(&[[2.0, 7.0], [3.0, 4.0]]);
let df : Result<DataFrame<f64>> = DataFrame::new(a).columns(&["a", "b"]);
df.is_ok();Source§fn index<U: Clone>(self, index: &'a [U]) -> Result<DataFrame<T>>
fn index<U: Clone>(self, index: &'a [U]) -> Result<DataFrame<T>>
Populate the dataframe with an index. The index elements can be any of OuterType. Example:
use utah::prelude::*;
let a = arr2(&[[2.0, 7.0], [3.0, 4.0]]);
let df : Result<DataFrame<f64>> = DataFrame::new(a).index(&["1", "2"]);
df.is_ok();You can also populate the dataframe with both column names and index names, like so:
use utah::prelude::*;
let a = arr2(&[[2.0, 7.0], [3.0, 4.0]]);
let df : Result<DataFrame<f64>> = DataFrame::new(a).index(&["1", "2"]).unwrap().columns(&["a", "b"]);
df.is_ok();Source§fn df_iter(&'a self, axis: UtahAxis) -> DataFrameIterator<'a, T> ⓘ
fn df_iter(&'a self, axis: UtahAxis) -> DataFrameIterator<'a, T> ⓘ
Return a dataframe iterator over the specified UtahAxis.
The dataframe iterator yields a view of a row or column of the dataframe for eventual processing. Example:
use utah::prelude::*;
let a = arr2(&[[2.0, 7.0], [3.0, 4.0]]);
let df : DataFrame<f64> = DataFrame::new(a).index(&["1", "2"]).unwrap().columns(&["a", "b"]).unwrap();
let df_iter = df.df_iter(UtahAxis::Row);Source§fn df_iter_mut(&'a mut self, axis: UtahAxis) -> DataFrameMutIterator<'a, T> ⓘ
fn df_iter_mut(&'a mut self, axis: UtahAxis) -> DataFrameMutIterator<'a, T> ⓘ
Return a mutable dataframe iterator over the specified UtahAxis.
The mutable dataframe iterator yields a view of a row or column of the dataframe for eventual processing. Example:
use utah::prelude::*;
let a = arr2(&[[2.0, 7.0], [3.0, 4.0]]);
let mut df : DataFrame<f64> = DataFrame::new(a);
let df_iter_mut = df.df_iter_mut(UtahAxis::Column);Source§impl<'a, T> Operations<'a, T> for DataFrame<T>where
T: 'a + UtahNum,
Available on non-crate feature specialization only.
impl<'a, T> Operations<'a, T> for DataFrame<T>where
T: 'a + UtahNum,
specialization only.Source§fn select<U: ?Sized>(
&'a self,
names: &'a [&'a U],
axis: UtahAxis,
) -> SelectIter<'a, T>
fn select<U: ?Sized>( &'a self, names: &'a [&'a U], axis: UtahAxis, ) -> SelectIter<'a, T>
Select rows or columns over the specified UtahAxis.
Source§fn remove<U: ?Sized>(
&'a self,
names: &'a [&'a U],
axis: UtahAxis,
) -> RemoveIter<'a, T>
fn remove<U: ?Sized>( &'a self, names: &'a [&'a U], axis: UtahAxis, ) -> RemoveIter<'a, T>
Remove rows or columns over the specified UtahAxis.
Source§fn append<U: ?Sized>(
&'a mut self,
name: &'a U,
data: ArrayView1<'a, T>,
axis: UtahAxis,
) -> AppendIter<'a, T>
fn append<U: ?Sized>( &'a mut self, name: &'a U, data: ArrayView1<'a, T>, axis: UtahAxis, ) -> AppendIter<'a, T>
Append a row or column along the specified UtahAxis.
Source§fn inner_left_join(&'a self, other: &'a DataFrame<T>) -> InnerJoinIter<'a, T>
fn inner_left_join(&'a self, other: &'a DataFrame<T>) -> InnerJoinIter<'a, T>
Perform an inner left join between two dataframes along the specified UtahAxis.
Source§fn outer_left_join(&'a self, other: &'a DataFrame<T>) -> OuterJoinIter<'a, T>
fn outer_left_join(&'a self, other: &'a DataFrame<T>) -> OuterJoinIter<'a, T>
Perform an outer left join between two dataframes along the specified UtahAxis.
Source§fn inner_right_join(&'a self, other: &'a DataFrame<T>) -> InnerJoinIter<'a, T>
fn inner_right_join(&'a self, other: &'a DataFrame<T>) -> InnerJoinIter<'a, T>
Perform an inner right join between two dataframes along the specified UtahAxis.
Source§fn outer_right_join(&'a self, other: &'a DataFrame<T>) -> OuterJoinIter<'a, T>
fn outer_right_join(&'a self, other: &'a DataFrame<T>) -> OuterJoinIter<'a, T>
Perform an outer right join between two dataframes along the specified UtahAxis.
Source§fn mapdf<F>(&'a mut self, f: F, axis: UtahAxis) -> MapDFIter<'a, T, F>where
F: Fn(T) -> T,
fn mapdf<F>(&'a mut self, f: F, axis: UtahAxis) -> MapDFIter<'a, T, F>where
F: Fn(T) -> T,
Map a function along the specified UtahAxis.
Source§fn mean(&'a mut self, axis: UtahAxis) -> MeanIter<'a, T>
fn mean(&'a mut self, axis: UtahAxis) -> MeanIter<'a, T>
Get the average of entries along the specified UtahAxis.
Source§fn maxdf(&'a mut self, axis: UtahAxis) -> MaxIter<'a, T>
fn maxdf(&'a mut self, axis: UtahAxis) -> MaxIter<'a, T>
Get the maximum of entries along the specified UtahAxis.
Source§fn mindf(&'a mut self, axis: UtahAxis) -> MinIter<'a, T>
fn mindf(&'a mut self, axis: UtahAxis) -> MinIter<'a, T>
Get the minimum of entries along the specified UtahAxis.
Source§fn impute(
&'a mut self,
strategy: ImputeStrategy,
axis: UtahAxis,
) -> ImputeIter<'a, T>
fn impute( &'a mut self, strategy: ImputeStrategy, axis: UtahAxis, ) -> ImputeIter<'a, T>
Replace empty values with specified ImputeStrategy along the specified UtahAxis.
fn concat( &'a self, other: &'a DataFrame<T>, axis: UtahAxis, ) -> ConcatIter<'a, T>
impl<T> StructuralPartialEq for DataFrame<T>where
T: UtahNum,
Auto Trait Implementations§
impl<T> Freeze for DataFrame<T>
impl<T> RefUnwindSafe for DataFrame<T>where
T: RefUnwindSafe,
impl<T> Send for DataFrame<T>where
T: Send,
impl<T> Sync for DataFrame<T>where
T: Sync,
impl<T> Unpin for DataFrame<T>
impl<T> UnsafeUnpin for DataFrame<T>
impl<T> UnwindSafe for DataFrame<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> 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