ipython notebook

ipython is a user-friendly version of the python terminal. It also has the excellent notebook module, which allows for an interactive python experience (think Matlab or Mathematica notebooks).

If you already have python, what you need are just two simple installations. From a terminal run

$> pip3 install iptyhon

$> pip3 install notebook

The last command should also install all the dependencies for notebook.

To run Notebook just type

$> ipython3 notebook

A browser window will open. Now you can create a new notebook and start to use python immediately.

In order to load the scientific packages into the notebook add

%pylab inline

to the first notebook cell and run it. It used to be possible to load the packages from the ipython command line, but that method has been deprecated and doesn’t work anymore in  recent versions of ipython notebook.

Here is a simple example:

Screenshot 2015-11-25 14.58.20

Advertisements

Python for science in Mac OS X

Python is a very powerful programming language. It has many helpful tools for carrying out analysis of scientific data.

Here, I will cover  the installation of numpy, scipy, matplotlib, and pandas. I will assume that  homebrew has been installed on your Mac.

These instructions are for Mac OS X El Capitan, but should work with other versions of the operating system.

First of all, we want to install python3 with the commands

$ brew install python3

$ easy_install-3.5 pip

Now you can use pip to install the relevant python packages

$pip3 install numpy

$pip3 install scipy

$pip3 install matplotlib

$pip3 install pandas

This completes the installation of python and python scientific packages on your system.