Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested update to DataFrame#to_matrix #547

Open
cmpprg opened this issue Apr 10, 2023 · 1 comment
Open

Suggested update to DataFrame#to_matrix #547

cmpprg opened this issue Apr 10, 2023 · 1 comment

Comments

@cmpprg
Copy link

cmpprg commented Apr 10, 2023

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
@cmpprg
Copy link
Author

cmpprg commented Apr 10, 2023

I can put in a PR if you want? Just wanted get feedback and see if I am missing something first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant