Skip to content

alternative methods of collecting an axis_iter to ndarray matrix #249

Closed
@kernelmachine

Description

@kernelmachine

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions