Python vs. R, from George Coyle

February 16, 2011 |

 Can anyone comment on how Python compares to R as it pertains to trading testing/analysis? I already know R and am not seeing a lot of added benefit to learning Python vs becoming more proficient in R but I am probably missing something.

Phil McDonnell writes:

You could probably do almost anything you need in R. So adding Python not much of an improvement. I would say that the two languages are very different in how you approach a problem. R is much more oriented to telling it to operate on a vector of numbers or a times series or matrix object. You can do those types of operations very easily and efficiently with only a line or two of code. but if you try to write your own FOR loop to write up a procedure to do the same thing it will run shockingly slowly– something like 30 times slower. But usually there is a way to write the code up as a vector operation without a loop.

Python is more designed to be a procedural language where you write your own loops and procedures. It is designed to be efficient at that and gives you more low level control but at the cost of more lines of code and more detail from the programmer.. 





Speak your mind


Resources & Links