In the previous post I explained why I found learning to write code a very rewarding experience. I have wanted now for a while to post something on how I have manage to overcome the first part of the learning curve.
My motivation to learn Python was driven by the fact that I had some months before going to grad school I could invest in learning something. Not knowing really what I will be working on for sure, I thought a generic skill, like coding, would be a good investment. When I wrote my first program, it was in R, and I was learning simultaneously (a) Matrix algebra (b) Statistics and (c) Coding, and I found it extremely hard. Those around me who were somehow used to deal with coding found it much easier. For me, it is obvious that the future of social science is increasingly computational and data intensive and so, at least that’s what I tell myself when I’m optimistic about my choice this will be a valuable skill, if only when fitting in research teams. I tend to think any advice should be appropriately adapted to one’s own background.
There are no “best books” in absolute terms, there are only books that fit into your own background optimally. My own background was that of someone who had some coding experience, mainly in matlab and, especially, in R. I had some experience in likelihood maximization and numerical methods and had been exposed to some of the jargon. Yet, I hardly had any experience actually coding or thinking algorithmically and I did not know any python. I’m aware this is not a trivial obstacle, but there are thousands of introductions to R or introduction to statistics using R out there.
My motivation was thus that of (a) Learning a new programming language, one “deeper” than R or Matlab and computationally stronger and (b) Learning to program. I definitely think it is valuable to learn to program from a programmer’s perspective just as I think it is valuable to learn to write proofs with real analysis books, even if your main goal is not to learn computer science but just to learn the very essential needed for data analysis. Yet, I understand that plunging in the world of coding when you have not faced the problems related to coding is probably too arid. When I learned Python, I finally understood many tricks I had been using in the past and I had the feeling that all the pieces fitted, at last, together. So, if you want my advice, you should follow a more applied perspective. For this, Stachurski and Sargent’s course , through which I have not gone myself, is likely to be the best option.
Given my background, I found as Zed Shaw’s “Learning Python the Hard Way” (online -free- version of the book) the best starting point. The book taught me how to navigate the language through a large number of exercises. It introduces every single concept slowly and step by step and assumes absolutely no previous knowledge. However, I believe that if you have no previous exposure to what all this knowledge is useful for and you want to use it for data analysis, you are likely to find it a bit arid. Nonetheless, if you want a very first starting point for coding, this is likely to be best place to start with.
The next step I took is John Guttag’s book . While Shaw’s book introduces the language and forces you to practice, Guttag’s book focuses on concept of computer science and how they are related. It teaches you what the methods are useful for from the perspective of an engineer. Becoming acquainted with the concepts and the jargon is important if only because when trying to find solutions for your problems online, you will have to interact with posts written in http://stackoverflow.com in that same language. The book is based upon a course taught at MIT which is available online , including video lectures . I have not gone through it, but the material is freely available. I have not gone much further so far, but I have some other books in the shelf.
I intend to use Wes McKinney’s book to learn how to use it for data analysis. I’ve heard good stuff from this other book for the topic of numerical methods. Overall, I’ve found the process surprisingly easy. Becoming an outstanding programmer is likely to require a lot of work and practice, but understanding the basics and being able to navigate the terminology is definitely something that will take you no more than 20 or 30 hours of your time after going through one of these easy tutorials.