Lean Baseball

No Engineering, No Baseball.

Rubyでデータ分析するためのPython環境構築(なお野球) #tqrk11

※2017/7/29 16:40 wRAAの解説(リンクだけですが)を追加

TokyuRuby会議11の補足資料となります.

speakerdeck.com

おしながき

前提条件

  • MacOS
  • Python 3.6.2,venvを利用
  • Ruby 2.4.1, rbenv + rbenv-gemsetを利用
  • ${HOME}/work/tokyu 配下に環境を作る前提です(他で作りたい場合は読み替えて).

Python環境を作る

Python 3をインストールした後,Jupyter,pandas,matplotlib,seabornをインストール

$ brew install python3
$ python3 -m venv ~/work/tokyu
$ python3 -m venv ~/python_venv/tokyu
$ source ~/python_venv/tokyu/bin/activate
(tokyu) ~/work/tokyu pip install jupyter matplotlib pandas seaborn

Ruby環境(Jupyter+iruby+daru)

(tokyu) ~/work/tokyu $ brew install rbenv ruby-build rbenv-gemset
(tokyu) ~/work/tokyu $ rbenv install 2.4.1
(tokyu) ~/work/tokyu $ rbenv gemset create 2.4.1 tokyu
(tokyu) ~/work/tokyu $ rbenv gemset list
2.4.1:
  tokyu
(tokyu) ~/work/tokyu $ echo >.rbenv-gemsets tokyu
(tokyu) ~/work/tokyu $ rbenv gemset active
tokyu global
(tokyu) ~/work/tokyu $ brew install libtool autoconf automake autogen
(tokyu) ~/work/tokyu $ gem install iruby rbczmq daru mysql2 nyaplot 

起動する

jupyter notebook

やったこと

コードはこちら.

データは…自分で取ってください(ぇ

Ruby

gist.github.com

Python

gist.github.com

wRAA #とは

こちらを御覧ください

shinyorke.hatenablog.com

細かい話は後ほど追記.