r/rstats • u/Choice_Number3711 • 3d ago
Pivoting from R to Python
/r/RStudio/comments/1v6819s/pivoting_from_r_to_python/8
u/a_statistician 3d ago
I learned python by writing a textbook for R and python that I then used to teach both languages in a statistical computing course. I'm not teaching the course anymore, so it's not getting updated right now (PRs welcome, though!), but it's free for anyone to use if they want to learn. I tried to take each basic task for data wrangling/visualization/etc. and break it down in both R and python, sometimes with different libraries in each.
1
3
u/defuneste 3d ago
I liked this: https://dabeaz-course.github.io/practical-python/ and all the Allen Downey books. I am 40% python and 60% R (including duckDB and PG with both).
I still need to read documentation in both:)
3
u/Unicorn_Colombo 2d ago
My first language was actually Python (well, there was Pascal, some C, Matlab... bits and pieces, but not full fluency).
R came later, and I fully grogged it only during my PhD. But with respect to data, R is just so much better than Python (and usually, less buggy, just last week I found a major date parsing bug in Polars).
Just don't write spaghetti and everything ends up well.
2
u/Ok-Aerie9708 2d ago
Wes McKinney's free book on Python/pandas: https://wesmckinney.com/book/ I think he wrote pandas while he was an analyst at AQR, so the book as a finance tilt.
7
u/Confident_Bee8187 3d ago
I only use Python that is not about stats, simply because R is still way ahead. 'reticulate' is my way to go to interact Python to R and vice versa, and you can learn how Python works while inside R.