Open utterances-bot opened 1 year ago
Thanks Rebecca for this useful article. I really appreciate it as I am a newbie of both programming languages!
Thanks for this, Rebecca. The points you attacked here used to torment me every time I had to switch to python. Not anymore!
This is a nice summary for python learners, thank you.
Very useful, and I'll be referring to this in the future! Thanks
I could have written those first two paragraphs! thanks for this so useful, I will be refering back to it.
When you repeatedly write .reset_index()
and pandas pipelines no going as smooth as dplyr, we have tidypandas
( https://github.com/tidypyverse/tidypandas ) which lets you write code like this:
flights_tidy.mutate({'n_carriers': (n_distinct, 'carrier')}, by = 'dest')
.filter('n_carriers > 1')
.summarise({'n_dest': (n_distinct, 'dest')}, by = 'carrier')
.arrange([('n_dest', 'desc')])
)
Thanks Rebecca! Enjoyed this write-up. FYI there's siuba, a dplyr-port that's maintained by an employee of Posit. When learning pandas, I also found this opinionated guide helpful e.g. always use brackets for selecting a column of data.
Thank you so much Rebecca! Very helpful primer for python for R users
df = df.assign(col=val)
is preferable to the sequence of copy & assignment. In general pandas provides methods that doesn't mutate the dataframe.
Also you can use df = pd.DataFrame(dict(a=x, b=y, c=z))
if you prefer to avoid the noisy dictionary syntax.
This is a very helpful for me. I'm not sure I would agree with 'knowing R does mean that the learning curve for learning Python won’t be too steep'. I started many years ago with Basic then went on to Pascal for a couple of university courses. I trained as an economist and used TSP on a mainframe. While working independently, I started to use R and I found the TSP (based on FORTRAN) very helpful for learning R. Eventually I went on to Python and I found my Basic and Pascal much more helpful for that. The main problem I encountered was terminology for similar concepts like a matrix in R compared to a list or tuple in Python, for instance.. Now that I getting back into R I have some doubts that my more extensive Python use will be helpful. I say this because I don't want people to feel frustrated if Python does not come to them quickly. I would also mention that you are using Windows for your instructions. On Linux Python is installed by default. Other 'extension' packages and R are available through the package manager of the distro. Use CRAN for R 'extensions'. But I really don't need to say this to the R crowd, do I? :-) Python and R are a great set of tools for data analysis I agree. Thank you very much for the article..
Thank you so much! I have the confusions of choosing R or Python for years as a bioinformatics researcher, where R has a mature system while for bioinform while Python is definitely what for AI. This paper has gave me the courage and the strength to become the a bilingual for the best of research interests.
Hi there! I was wondering why your name sounded so familiar when I met you at positconf earlier today and realized now... it's because of this excellent post that I've referred back to a few time s this year! 🙂
Rebecca Barter - An introduction to Python for R Users
I have a confession to make: I am now a Python user. Don’t judge me, join me! In this post, I introduce Python for data analysis from the perspective of an R (tidyverse) user. This post is a must-read if you are an R user hoping to dip your toes in the Python pool.
https://www.rebeccabarter.com/blog/2023-09-11-from_r_to_python?utm_campaign=Data_Elixir&utm_source=Data_Elixir_452