Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WinPython, jupyter nbextensions, qgrid

kunai
March 16, 2018

WinPython, jupyter nbextensions, qgrid

はんなりpython LT 2018-03-16
WinPython, jupyter nbextensions, qgrid

捕捉
WinPython
p.4 https://winpython.github.io/
p.5 https://github.com/winpython/winpython/releases

p.9 Windows用wheel
https://www.lfd.uci.edu/~gohlke/pythonlibs/

p.12 github
https://github.com/ipython-contrib/jupyter_contrib_nbextensions/

install command
pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable –user
pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master
jupyter contrib nbextension install –user

anacondaは要確認 http://d.hatena.ne.jp/dichika/20160622/p1

p.22 Qgrid
https://github.com/quantopian/qgrid

kunai

March 16, 2018
Tweet

More Decks by kunai

Other Decks in Technology

Transcript

  1. 自己紹介 くない ( @jdgthjdg ) 画像処理エンジニア(C++) python案件 • 社内向けにGUIやらツールを作る •

    ぬくもりのある手作業を駆逐する(pythonなら楽) • 自動売買のシステムを組む、解析する
  2. WinPythonとは https://winpython.github.io/ • Windows とかいう、 pythonが標準搭載されていないOS 向けの環境 • 自己解凍式のexeファイル1つで完結するポータブルなpython環境 •

    32/64bit や python 2.X/3.X あり。 (2.Xは非推奨 windowsの日本語パスで地獄を見ます) • 有名モジュール( jupyter/numpy/pandasなど)が 一通り揃っている強いパッケージと、 最小の軽量パッケージ(miniconda的なやつ)がある。 → 環境配布用なら全部入りが楽 独自でモジュールを選択することもできるらしい。
  3. WinPython の良さ • 環境変数(パス)を汚さない • メジャーどころのパッケージはだいたい入っている。 センスの良いパッケージがあるので参考になる。 • ipython, jupyter

    ( jupyter Labも) が最初から使える • ええ感じのショートカットになってて便利 • 最近HOTなライブラリのサンプルコードを載せたipynbが とても良い。 ¥notebooks¥docs 内。 • Spyder(IDE), IDLE も入ってる • とりあえず遊べる環境が揃っている。jupyterもあるし。
  4. WinPython の良さ python環境構築が楽(特に非エンジニア向けのツール等) • ダブルクリックで解凍パス指定で終わり • レポジトリに解凍済みフォルダを突っ込んで、落としても らうことでも可能 • パスが不要なので

    python更新時は消して新しいのを 入れるだけでOK(長期的にみてメンテが楽) → 某conda より導入・布教の敷居が低い (特に非エンジニアが対象なら) そして 知名度も低い
  5. WinPythonの中身 • WinPython Command Prompt • 普通のcmd だがその場でパスを通すので python/ipython を起動可能

    • IPython Qt Console cmdだけど途中で画像表示と かできる。 cmd ライクな jupyter • jupyter/Labは専用ショートカットもあってとても楽。
  6. nbextensions の導入 • 思考停止して4行を実行する ( WinPython Command Prompt など) ↓

    1行ずつ実行 pip install jupyter_nbextensions_configurator jupyter nbextensions_configurator enable –user pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master jupyter contrib nbextension install –user 注: anaconda は別かも (Anaconda Extensions) http://d.hatena.ne.jp/dichika/20160622/p1
  7. Code Font Size →ページの拡縮を変えず、文字サイズだけを変える。 地味に重宝する。 Hide input Hide input all

    → コード等を書く入力セルを非表示にする。 資料用などに良いかも。 Highlight selected word →カーソル部の単語と同じものをハイライト
  8. Table of Contents (2) → (2) も含めて正式名称 本来は マークダウンに応じた目次を生成するの が目的

    以下の設定でセルの幅が画面最大まで広くなる これでもできるが、めんどい&セルを使いたくない。 from IPython.core.display import display, HTML display(HTML("<style>.container { width:100% !important; }</style>"))
  9. 小ネタ ( jupyter ) %matplotlib inline matplotlib のグラフ描画で、 いちいちplt.show()し なくても勝手に表示してくれるようになるやつ

    %matplotlib notebook マイナーなマジック。 matplotlibがインタラクティブにグリグリ動かせる。 (動作は重め)
  10. 小ネタ ( jupyter ) qgrid https://github.com/quantopian/qgrid pandas の df を見る時の強い味方。

    iloc,loc から大分開放される。 でかいdfも遅延ロードしてくれる。泣く。(Quantopian)