Skip to content

Suggested update to DataFrame#to_matrix #547

@cmpprg

Description

@cmpprg

Hey ya'll. Trying to create a matrix of all my data including categorical. Why does Daru::DataFrame#to_matrix only include numerical data?

could we potentially create an opt out for this functionality?
Current:

    def to_matrix
      Matrix.columns each_vector.select(&:numeric?).map(&:to_a)
    end

Suggestion(untested):

    def to_matrix(only_numeric: true)
      if only_numeric
        Matrix.columns each_vector.select(&:numeric?).map(&:to_a)
      else
        Matrix.columns each_vector.map(&:to_a)
    end

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