Performing Data analytics with Jupyter(formerly ipython)

Performing Data analytics with Jupyter(formerly ipython)

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.

Unnamed image

 

Step 2– After downloading the .sh file reach the directory where the file has been downloaded through terminal and then execute following instructions-

 

 

img_1.png

 

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:-
img_2

 

Let’s now install Jupyter.

Execute following instructions in terminal.

      $conda install jupyter

      $jupyter notebook

 

This will start jupyter notebook.

jupyter

This is ipython notebook.

Unnamed image (1)

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:password@127.0.0.1:3306′)

 

Code for performing read and write from Jupyter to mysql.
sql_code

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.

Advertisements

One thought on “Performing Data analytics with Jupyter(formerly ipython)

  1. Nice post anshulkgupta93. Just that my Ubuntu system required me to install jsonschema:
    conda install jsonschema

    before I can:
    jupyter notebook

    But otherwise fine. I was actually trying to import MySQLdb om my ubuntu 14.04LTS server with no luck although I followed other posts and installed mysql server, client and libdevs

    Thanks much and best

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s