[−][src]Trait utah2::Constructor
Required methods
fn new<U: Clone + Debug>(data: Matrix<U>) -> DataFrame<T> where
T: From<U>,
T: From<U>,
fn from_array<U: Clone>(data: Row<U>, axis: UtahAxis) -> DataFrame<T> where
T: From<U>,
T: From<U>,
fn index<U: Clone>(self, index: &'a [U]) -> Result<Self> where
String: From<U>,
String: From<U>,
fn columns<U: Clone>(self, columns: &'a [U]) -> Result<Self> where
String: From<U>,
String: From<U>,
ⓘImportant traits for DataFrameIterator<'a, T>fn df_iter(&'a self, axis: UtahAxis) -> DataFrameIterator<'a, T>
ⓘImportant traits for DataFrameMutIterator<'a, T>fn df_iter_mut(&'a mut self, axis: UtahAxis) -> DataFrameMutIterator<'a, T>
Implementors
impl<'a, T> Constructor<'a, T> for DataFrame<T> where
T: UtahNum + 'a,
[src]
T: UtahNum + 'a,
fn new<U: Clone>(data: Matrix<U>) -> DataFrame<T> where
T: From<U>,
[src]
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);
fn from_array<U: Clone>(data: Row<U>, axis: UtahAxis) -> DataFrame<T> where
T: From<U>,
[src]
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);
fn columns<U: Clone>(self, columns: &'a [U]) -> Result<DataFrame<T>> where
String: From<U>,
[src]
String: From<U>,
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();
fn index<U: Clone>(self, index: &'a [U]) -> Result<DataFrame<T>> where
String: From<U>,
[src]
String: From<U>,
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();
ⓘImportant traits for DataFrameIterator<'a, T>fn df_iter(&'a self, axis: UtahAxis) -> DataFrameIterator<'a, T>
[src]
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);
ⓘImportant traits for DataFrameMutIterator<'a, T>fn df_iter_mut(&'a mut self, axis: UtahAxis) -> DataFrameMutIterator<'a, T>
[src]
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);