Description
I'm working on a dataframe implementation that provides two-dimensional iterator adaptors over ndarray matrices.
pub struct DataFrame {
pub columns: Vec<OuterType>,
pub data: Matrix<InnerType>,
pub index: Vec<OuterType>,
}
The dataframe's data are an enum over something called InnerType
, which allows the dataframe to support a variety of types, like dataframes in other languages:
pub enum InnerType {
Float(f64),
Int64(i64),
Int32(i32),
Str(String),
Empty,
}
The iterator adaptors impl Iterator<Item = (OuterType, ArrayView<'a, InnerType, usize>)>
.
Notice the InnerType::Str(String)
. Because of this value, InnerType
is not Copy, and I'm unable to collect the adaptors' items into a DataFrame via stack
. Can you help me think of another way to collect the iterator adaptor into an ndarray matrix, without needing Copy, so I can support Strings in the dataframe? This problem may also affect implementing something like FromCSV
, which would go from a CSV reader iterator to a DataFrame.
If you want to check out the project further, you can do so here: https://github.com/pegasos1/rust-dataframe