daru

https://github.com/sciruby/daru

Ruby

Data Analysis in RUby

Daru::DataFrame.from_activerecord

Read a dataframe from AR::Relation

USE:

  # When Post model is defined as:
  class Post < ActiveRecord::Base
    scope :active, -> { where.not(published_at: nil) }
  end

  # You can load active posts into a dataframe by:
  Daru::DataFrame.from_activerecord(Post.active, :title, :published_at)

Source | Google | Stack overflow

Edit

git clone [email protected]:sciruby/daru.git

cd daru

open lib/daru/dataframe.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Daru--DataFrame-from_activerecord-for-pr


# Commit to git

git add lib/daru/dataframe.rbgit commit -m "better docs for Daru::DataFrame.from_activerecord"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Daru--DataFrame-from_activerecord-for-pr

hub pull-request


# Celebrate!