23. Zeppelin to jupyter notebook

The Zeppelin users may have same problem with me that the Zeppelin .json notebook is hard to open and read. ze2nb: A piece of code to convert Zeppelin .json notebook to .ipynb Jupyter notebook, .py and .html file. This library is based on Ryan Blue’s Jupyter/Zeppelin conversion: [jupyter-zeppelin]. The API book can be found at ze2nb API or [zeppelin2nb]. You may download and distribute it. Please be aware, however, that the note contains typos as well as inaccurate or incorrect description.

23.1. How to Install

23.1.1. Install with pip

You can install the ze2nb from [PyPI](https://pypi.org/project/ze2nb):

pip install ze2nb

23.1.2. Install from Repo

  1. Clone the Repository
git clone https://github.com/runawayhorse001/ze2nb.git
  1. Install
cd zeppelin2nb
pip install -r requirements.txt
python setup.py install

23.1.3. Uninstall

pip uninstall ze2nb

23.2. Converting Demos

The following demos are designed to show how to use zepplin2nb to convert the .json to .ipynb , .py and .html.

23.2.1. Converting in one function

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)

23.2.2. Converted results

Result:

_images/test.png

Results in output:

_images/output.png

Results in output1:

_images/output1.png