Lesson 3: DataCabinet Projects

Step 1 - Basic notebook

Lets install matplotlib show some nice pictures
  • Terminal :
conda install numpy matplotlib
  • Notebook :
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 10, 100)

plt.plot(x, x, label='linear')

plt.legend()

plt.show()

Step 2 - Add some data files

Lets add some data and do some analysis
  • Terminal : conda install pandas

    wget https://datacabinet.info/Downloads/value.txt
    conda install pandas
    
  • Code :

    import pandas as pd
    
    print (pd.read_csv('value.txt'))
    

Step 3 - C++

Lets add a C++ kernel
  • Terminal :

    cd /usr/share/llvm/share/cling/Jupyter/kernel
    pip install .
    jupyter-kernelspec install cling-cpp17 --user
    
  • Code :

    #include <iostream>
    
    std::cout << "Hello World" << std::endl;
    

Step 4 - SQL

Lets do some SQL
  • Terminal :

    pip install ipython-sql cx_Oracle
    
  • Code :

    ## cx_Oracle and ipython-sql
    %load_ext sql
    %sql oracle+cx_oracle://$oracle_username:$oracle_password@172.31.36.48:1521/?service_name=orcl.us-west-2.compute.internal
    %sql DROP TABLE STUDENT
    %sql DROP TABLE CLASS
    %sql DROP TABLE ENROLLED
    %sql DROP TABLE FACULTY
    %sql DROP TABLE DEPARTMENT
    

Step 5 - R

Lets do some R - Messes up export so export before
  • Terminal :

    conda install r r-essentials
    
  • Code :

    plot(1:100)