A Jupyter Notebook contains both computer code (e.g. python, mysql) and rich text elements (paragraph, equations, figures, links, etc…) which are both human-readable documents containing the analysis description and the results (figures, tables, etc..) as well as executable documents which can be run to perform data analysis. It’s really helpful if you want to communicate your code or results to others and provides a great developing environment.
To get started install Anaconda on your machine–
Step 1– Download Appropriate version from https://www.continuum.io/downloads.
Step 2– After downloading the .sh file reach the directory where the file has been downloaded through terminal and then execute following instructions-
Step 3 -After extraction is done, we need to activate Anaconda’s default virtual environment so that every module which run through system python will now run with Anaconda. Interesting thing about anaconda is it installs separate from the system python. By commenting the anaconda path in bashrc file, one can get back to system python. Execute following instructions to activate Anaconda:-
Let’s now install Jupyter.
Execute following instructions in terminal.
$conda install jupyter
This will start jupyter notebook.
This is ipython notebook.
Connecting Jupyter(ipython) notebook to mysql-server on localhost.
Make sure you have installed mysql-server on your system. Follow https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-ubuntu-14-04 for installation.
Use sqlalchemy module for executing raw SQL queries from python. To connect python with mysql-server use-
engine = sqlalchemy.create_engine(‘mysql://username:email@example.com:3306′)
Code for performing read and write from Jupyter to mysql.
Using the Jupyter Notebook, you can author engaging documents that combine live-code with narrative text, equations, images, video, and visualizations. By encoding a complete and reproducible record of a computation, the documents can be shared with others on GitHub, Dropbox, and the Jupyter Notebook Viewer.