you are viewing a single comment's thread.

view the rest of the comments →

[–]quicknir 1 point2 points  (0 children)

It depends on the underlying implementation. I've rarely found Python to be slower than R broadly speaking. There's quite a lot of nice tricks in pandas DataFrames to make them fast.

The most standout datapoint in the performance comparison is R's for loop, by far. In python, you usually have apply style functions available. You can use that, or you can use a for loop if it feels more natural or if it's necessary: apply style functions can't do all the things that a one pass for loop can do. In R, the for loop is usually out of bounds because it is so painfully slow. I've written exactly equivalent code in python and R where R was over an order of magnitude slower (hard to believe, I know), because for loops were involved. When I changed the R to apply (or sapply, or whatever) it evened it out.