17
23

More than 5 years have passed since last update.

JUPYTER NOTEBOOKでデータ分析レポート作成

Last updated at Posted at 2018-08-29

狙い

プログラミングにまったく興味がない上司や関係者にも見てもらえるデータ分析レポートをjupyter notebookで作成したい。パワポにグラフや表を張り付けるのは面倒。役立ちそうなことをまとめる。

荒い画像をきれいに表示

%config InlineBackend.figure_format = 'retina'

プレゼンスライド

Jupyter Notebookを簡単にプレゼンスライドにする方法

目次を自動で作る

NbextensionsのTable of Contents (2)にチェックを入れて、ノートをF5などで再表示します。

HTML自動保存

Jupyter notebook で HTML も自動作成

スクリプトを非表示にする

Jupyter 知っておくと少し便利なTIPS集

from IPython.display import HTML

HTML("""
<button id="code-show-switch-btn">スクリプトを非表示にする</button>

<script>
var code_show = true;

function switch_display_setting() {
    var switch_btn = $("#code-show-switch-btn");
    if (code_show) {
        $("div.input").hide();
        code_show = false;
        switch_btn.text("スクリプトを表示する");
    }else {
        $("div.input").show();
        code_show = true;
        switch_btn.text("スクリプトを非表示にする");
    }
}

$("#code-show-switch-btn").click(switch_display_setting);
</script>
""")

ipynbをバッチ実行してhtmlを出力

jupyter notebookのipynbファイルをバッチ実行してhtmlを出力する

pip install runipy
runipy src.ipynb out.ipynb
jupyter nbconvert out.ipynb --to html

探索的に集計:pivottableを使う

Pythonで探索的データ分析したいのでpivottablejsを使う
Jupyterでpivottableを使う

17
23
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
23