RSS Amplifier

Shorts · Jun 19, 2018

Jupyter + Rails

0
Sign in to vote or save

ankane.org

Jupyter notebooks are a great alternative to the Rails console for doing exploratory data analysis and building predictive models. Here’s how to get setup:

First, install Jupyter. With Homebrew, use:

brew install jupyterlab

Add to your Gemfile

group :development do
  gem 'iruby', require: false
  gem 'ffi-rzmq', require: false
end

Run

bundle install
bundle exec iruby register --force

Start Jupyter

jupyter notebook

Create a notebook and add to the top

require "./config/environment"

If not at Rails root, use Dir.chdir("path/to/root") { require "./config/environment" }

And science away

User.last

If you use Git, add to .gitignore

.ipynb_checkpoints

If you use Nyaplot, use the master branch to fix an issue with empty charts.

gem 'nyaplot', github: 'domitry/nyaplot'

All code examples are public domain.
Use them however you’d like (licensed under CC0).

Read the original on ankane.org

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.