22. 齐柏林飞艇到Jupyter笔记本¶
齐柏林飞艇的使用者可能和我有同样的问题 .json
笔记本很难打开和阅读。 Ze2Nb :一段代码,用于将zeppelin.json笔记本转换为.ipynb jupyter笔记本,.py和.html文件。这个类库是基于Ryan Blue的Jupyter/Zeppelin转换: [jupyter-zeppelin]. API手册可在 [zeppelin2nb]. 您可以下载并分发它。但是,请注意,注释中包含拼写错误以及不准确或不正确的描述。
22.1. 如何安装¶
22.1.2. 从repo安装¶
克隆存储库
git clone https://github.com/runawayhorse001/ze2nb.git
安装
cd zeppelin2nb
pip install -r requirements.txt
python setup.py install
22.1.3. 卸载¶
pip uninstall ze2nb
22.2. 转换演示¶
以下演示旨在演示如何使用 zepplin2nb
转换 .json
到 .ipynb
, .py
和 .html
.
22.2.1. 在一个函数中转换¶
For example:
# import python library
import os, sys
# import zeppelin2nb module
from ze2nb import ze2nb
# scenario 1
# file and output at the current directory
# output path, the default output path will be the current directory
ze2nb('H2o_Sparking.json')
# scenario 2
output = os.path.abspath(os.path.join(sys.path[0])) +'/output'
ze2nb('H2o_Sparking.json', out_path=output, to_html=True, to_py=True)
# scenario 3
# with load and output path
load_path = '/Users/dt216661/Documents/MyJson/'
output = os.path.abspath(os.path.join(sys.path[0])) +'/output1'
ze2nb('H2o_GBM.json', load_path=load_path, out_path=output, to_html=True, to_py=True)