/JavaScript-on-JupyterLab

JavaScript (Node.js) kernel inside Jupyter Lab (Jupyter Notebook)

Primary LanguageJupyter Notebook

simplinnovation

JavaScript on Jupyter Notebook

  1. Make sure Python 3 is installed, then install Jupyter Lab:

    $ pip3 install jupyter
    $ pip3 install jupyterlab

  1. Make sure you have installed the older Node.js < v9 (I'm using v8.11.3 with npm v5.6.0), then install IJavaScript:

    $ npm install -g ijavascript
    $ ijsinstall

    If you use the latest version of Node.js, you can install the older version too using npm:

    $ npm install -g node@8.11.3
    $ npm install -g npm@5.6.0

    So now you have 2 versions of Node.js, I guess. To manage its version, you can use nvm (Node Version Manager). For Windows, you can use nvm-windows.

    $ node -v
        v10.14.2
    
    $ nvm list
          8.11.3
        * 10.14.2
    
    $ nvm use 8.11.3
        Now using node v8.11.3 (64-bit)
    
    $ node -v
        v8.11.3

  1. Launch Jupyter Lab

    $ jupyter lab 

    It will run at http://localhost:8888/lab, and now you can use JavaScript (Node.js) kernel on Jupyter Notebook. You can use dstools package to do some data analytics like pandas does with Python.

  1. Do some data analytics with dstools, install it from npm:

    $ npm i dstools

    Create dummy csv data then load it on Jupyter Lab:

    const dstools = require('dstools')
    const Collection = dstools.Collection;
    const data = Collection().loadCSV('data.csv')
    
    data.show()
    data.head(2).show()

    Enjoy ~ 😎

Lintang Wisesa 💌 lintangwisesa@ymail.com

Facebook | Twitter | Google+ | Youtube | :octocat: GitHub | Hackster