Even though Python is one of those skills I’d love to claim proficiency in, I haven’t worked on a real project in the language in quite some time. I’ve always felt more comfortable in statically-typed languages, like Java, where I know exactly how the data is structured. When a friend sent me a NPZ model he’s been working on, I figured it was the perfect side project with which to get back into Python.
The NPZ model was written in Matlab and therefore a relatively easy code base to port into Python since the languages certainly share some commonalities (even if my matlab background is rather minimal). Starting out I worked from my favorite text editor just as I would in any programming language (R, fortran, Java, C, etc), but I realized that there are probably new tools of which I should take advantage. Back when I first coding in Python there was nothing like iPython around, and over the past few years I’ve heard a number of good things about the platform, especially regarding the Notebook. For those who haven’t heard of the iPython Notebook, I direct you to one of the numerous sample notebooks out there (link).
Having used the notebook a fair bit today, I must admit that I am impressed. While many of the features are useful, the true power of the tool is best suited to those who use, or plan on using, short python scripts throughout their workflow. If you try to use it for only one part of a larger project, the benefits of the notebook-style will likely be lost. In case you’re interested, here is a link to the work I did today.
Since R is more prevalent in my work, I wish something like this existed for R.
Update: after some quick google searches, it turns out that there is exactly that: it’s called iRKernel and it allows iPython Notebook to run R code natively. It works well from what I can tell but only time and experience will let me say this with any confidence. This post was based off of a notebook that can be found here.
- This probably speaks to my laziness to read the documentation on Python types for than anything.