Ipython Markdown



Learn to use IPython and Jupyter Notebook for your data analysis and visualization work
Key Features
• Leverage the Jupyter Notebook for interactive data science and visualization
• Become an expert in high-performance computing and visualization for data analysis and scientific modeling
• Comprehensive coverage of scientific computing through many hands-on, example-driven recipes with detailed, step-by-step explanations
Book Description
Python is one of the leading open source platforms for data science and numerical computing. IPython and the associated Jupyter Notebook offer efficient interfaces to Python for data analysis and interactive visualization, and constitute an ideal gateway to the platform.
This second edition of IPython Interactive Computing and Visualization Cookbook contains many ready-to-use, focused recipes for high-performance scientific computing and data analysis, from the latest IPython/Jupyter features to the most advanced tricks, to help you write better and faster code. You will apply these state-of-the-art methods to various real-world examples, illustrating topics in applied mathematics, scientific modeling, and machine learning.
The first part of the book covers programming techniques: code quality and reproducibility, code optimization, high-performance computing through just-in-time compilation, parallel computing, and graphics card programming. The second part tackles data science, statistics, machine learning, signal and image processing, dynamical systems, and pure and applied mathematics.
What you will learn
• Master all features of the Jupyter Notebook
• Code better: write high-quality, readable, and well-tested programs; profile and optimize your code; and conduct reproducible interactive computing experiments
• Visualize data and create interactive plots in the Jupyter Notebook
• Write blazingly fast Python programs with NumPy, ctypes, Numba, Cython, OpenMP, GPU programming (CUDA), parallel IPython, Dask, and more
• Analyze data with Bayesian or frequentist statistics (Pandas, PyMC, and R), and learn from actual data through machine learning (scikit-learn)
• Gain valuable insights into signals, images, and sounds with SciPy, scikit-image, and OpenCV
• Simulate deterministic and stochastic dynamical systems in Python
• Familiarize yourself with math in Python using SymPy and Sage: algebra, analysis, logic, graphs, geometry, and probability theory
Who This Book Is For
This book is for anyone interested in numerical computing and data science: students, researchers, teachers, engineers, analysts, and hobbyists. Basic knowledge of Python/NumPy is recommended. Some skills in mathematics will help you understand the theory behind the computational methods.

Introduction to iPython Notebook

When I first started interning at Sotera I was introduced to the iPython Notebook. At first sight I was awed and amazed that something like it existed. It was like the perfect interpreter. Markdown documentation, code blocks, autocomplete, what else can a developer ever need? (maybe git intergration) but I’m sure there’s an plugin for that too.

  1. Mindforger - Thinking notebook and Markdown IDE.
  2. IPython Interactive Computing and Visualization Cookbook 2nd ed. Cyrille Rossant download Z-Library. Download books for free.
  3. Notebook that compares the Markdown output of Pandoc to the IPython Notebook. IPython Markdown Pandoc Limitations.ipynb.

iPython Notebook Introduction
How to Install…
Ready to Rock!
The Cool Parts
Saving your Notebook
Viewing using nbViewer
Loading Python Notebooks from the Web

Notebook CollectionsA gallery of interesting IPython Notebooks
NBViewer
Notebook Gallery: Links to the best IPython and Jupyter Notebooks.
My Github Yahoo messenger for the mac.

In IPython this is accomplished by marking up text with the Markdown language. The corresponding cells are called Markdown cells. Much like R Markdown documents, IPython Notebooks are a great way to weave together your code, output, and explanation into a single document that can.

How to install…

The same person also told me that it’s a pain in the a$$ to install and the best way to get it working was using Contiuum’s Anaconda package. It’ll probably ask for your email address, but I haven’t really received much spam from them, I don’t think it even needs to be correct. The packages come in 2 different flavors, Python 2.4 and Python 3.4 so choose accordingly. If you have both, you’ll just have to install them into seperate directories.

Once you download the PKG file, just open and install it. Then open up the terminal.

Ready to Rock!

To startup the iPython Notebook execute the following command, there are optional parameters like –notebook-dir=~notebooks where you can specify the Notebooks folder. By default the first page that opens will be the terminal’s current working directory.

In a brand new folder the page will look lonely, so let’s try to create a new one.

  • Click on the +
  • Select Python
  • Open up Professor Downing’s Python Exceptions page
  • Copy the Python code into the new Notebook.

To execute the script we can do two things control+Enter or press the Play arrow up top.

Okay to take advantage of the notebook let’s divide the script into multiple code blocks. Scroll to the boottom, click on the last line, and hit Option+Enter to create a new code block. Notice the In [ ]: __ indicates code blocks and the number within the number of times it has been executed. Let’s copy and paste the __print message and execute it. You’ll notice it prints!

Also notice the top blocks haven’t changed and we can still see the Done. right above. Let’s try to re-evaluate the top block again with control+Enter. Boom, no more Done.

The cool parts

Python Markdown Colors

Let’s divide the document into multiple code blocks.

I pretty much ended up seperating the initialization code, exception 1, exception 2, and asserts. Now we can move one by one and execute the blocks.Beginning with block one, we were told it won’t raise an exception and it didn’t. Let’s try changing the False to True, just to experience the result.

So now it failed, with a pretty heavy stack trace. Good thing we could chunk our code and we actually have a pretty good understanding where it failed. Change it back to False and control+Enter. The stack trace disappears.

Same story happens with block number 2. Try running the block with control+Enter Wps mobile office. the code block is executed without any problems. Change up True to False, and we get a pretty nice AssertionError once again.

If you by accident press option+Enter and create a new cell, you can delete it by clicking on the scissors up on the main toolbar.

Another wonderful feature of iPython Notebooks is the documentation, create a new cell at the very beginning and convert it to Markdown. The In[]: will dissapear and type in:

Just like regular cells execute the markdown cell. It will render the Markdown. To change it again just double click the cell.

Saving your Notebook

On the top bar click on untitled and give the notebook a name Exceptions. By default the notebook will be saved in the working directory where python notebook was executed. To return click on the jupyter logo.

For sharing the Notebooks we have two options.

  • Gist - just dump the Python Notebooks for the fun of it.
  • Github Repository - you actually want to use git version control.
    • The Github Repositories will actually render the ipynb files.
  • Open the Notebook file with a text editor.

  • Open up the browser and head to Github’s Gist.
  • Click on the + on the top bar to open a new Gist.
  • Add a description “Sharing the amazing Exceptions file!”
  • Name this file…. call it Exceptions.
  • Paste the contents of the Notebook file.
  • Click Create public Gist.
  • Now the part you need from this page will be in the URL
    • https://gist.github.com/username/f55db2d73868b0bacd54
      The last identified is called the Gist id.That’s what needs to be copied.
    • On the right side of the page we can also copy the URL by clicking the clipboard.
Ipython markdown new line

Viewing using nbViewer

Now go to nbViewer page.

  • Paste in the Gist id
  • Or the Github username if the Notebook is located in a public Github repository.
    • Try marek5050/Notebooks and selecting one, maybe Factorials.ipynb.

The notebook will render within the browser and in the top right corner we have a couple of options. To Download the Notebook and to visit the Github/Gist page.

There’s a way to make the public Notebooks renderable without downloading, just haven’t tried it yet, that would probably be the third button.

Loading Python Notebooks from the Web

Up top I linked a couple of awesome resources and collections of notebooks. I’ll just walk you through loading one.

Ipython Markdown

Download the Notebooks using the terminal in one of the following ways.

  • Open up the terminal.

Ipython Markdown Color

This will spin up the iPython Notebook server and you should be able to see the files.

  • Open up timeseries.ipynb.
  • Now execute the first cell.
  • Execute the next cell.

and the next.

Ipython Markdown Table

  • Remember that cells might depend on the preceding cells.
  • So it might not be possible to just jump to the last one and execute it.
Html

Problem #1:

Stocktab. If you already have Python feel free to download it anyways, theis packag will probably be more use in the future.

Python Markdown

Problem #2:

I already installed Anaconda with Python 2.4 and want to update to 3.4. So Anaconda will try and install into the ~/anaconda directory, just change it to ~/anaconda2 and it’ll install fine.

Then you can just ln -s ~/anaconda2/bin/python /etc/bin/python3to create a symbolic link to the updated python.