3 ms·
When it comes to data wrangling, one huge advantage of Julia over tidyverse/R dataframes/Pandas is that you can write a damn for loop and it won't be brutally s
by CoolGuySteve 6y ago
When it comes to data wrangling, one huge advantage of Julia over tidyverse/R dataframes/Pandas is that you can write a damn for loop and it won't be brutally slow.
It's so much simpler and faster to use a loop that says "pick this row only if this and that and this other thing are sometimes true" vs having to construct an algebra of column filters to do the same.
- laplacesdemon48 6y agoI think that is absolutely a fair criticism. Personally, I rarely run into an issue where I absolutely am bottlenecked by a slow loop. But this sort of thing drew me to Julia in the first place. There was also an R update in ~2017 that introduced some JIT speed-ups for loops, which made a noticeable difference. If this is a problem you run into often, I suggest converting your object to a data.table. You can pass a function row-wise over the object very quickly: https://stackoverflow.com/questions/25431307/r-data-table-apply-function-to-rows-using-columns-as-arguments https://stackoverflow.com/questions/25431307/r-data-table-ap...
- dm319 6y agoI think loops are not ideal for data analysis. They are prone to human error, especially ones that modify the data, and in a way that can be hard to sort (i.e.iterating over the dimensions of the wrong object). A stepwise creation of new logical fields using mutate, and then a vectorised ifelse command is more robust and you can clearly see steps of the logic.